Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Directed Acyclic Graph DAG – directed graph with no directed cycles.

Similar presentations


Presentation on theme: "1 Directed Acyclic Graph DAG – directed graph with no directed cycles."— Presentation transcript:

1 1 Directed Acyclic Graph DAG – directed graph with no directed cycles

2 2 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket

3 3 Topological Sort Linear ordering of the vertices of G, such that if (u,v) E, then u appears smewhere before v.

4 4 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket SocksUnderwearPantsShoesWatchShirtBeltTieJacket

5 5 Topological Sort Topological-Sort ( G ) 1.call DFS ( G ) to compute finishing times f [ v ] for all v V 2.as each vertex is finished, insert it onto the front of a linked list 3.return the linked list of vertices Topological-Sort ( G ) 1.call DFS ( G ) to compute finishing times f [ v ] for all v V 2.as each vertex is finished, insert it onto the front of a linked list 3.return the linked list of vertices Time: (| V|+|E| ).

6 6 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket 1 | Undiscovered Active Finished Unfinished

7 7 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket 1 | 2 | Undiscovered Active Finished Unfinished

8 8 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket 1 | 2 | 3 | Undiscovered Active Finished Unfinished

9 9 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket 1 | 2 | 3 | 4 Undiscovered Active Finished Unfinished

10 10 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket TieJacket 1 | 2 | 5 3 | 4 Undiscovered Active Finished Unfinished

11 11 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket TieJacket 6 | 1 | 2 | 5 3 | 4 Undiscovered Active Finished Unfinished

12 12 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket BeltTieJacket 6 | 7 1 | 2 | 5 3 | 4 Undiscovered Active Finished Unfinished

13 13 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket ShirtBeltTieJacket 6 | 7 1 | 8 2 | 5 3 | 4 Undiscovered Active Finished Unfinished

14 14 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket ShirtBeltTieJacket 6 | 7 1 | 8 2 | 5 3 | 4 9 | Undiscovered Active Finished Unfinished

15 15 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket WatchShirtBeltTieJacket 6 | 7 1 | 8 2 | 5 3 | 4 9 |10 Undiscovered Active Finished Unfinished

16 16 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket WatchShirtBeltTieJacket 11 | 6 | 7 1 | 8 2 | 5 3 | 4 9 |10 Undiscovered Active Finished Unfinished

17 17 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket WatchShirtBeltTieJacket 11 | 12 | 6 | 7 1 | 8 2 | 5 3 | 4 9 |10 Undiscovered Active Finished Unfinished

18 18 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket WatchShirtBeltTieJacket 11 | 12 | 6 | 7 13 | 1 | 8 2 | 5 3 | 4 9 |10 Undiscovered Active Finished Unfinished

19 19 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket ShoesWatchShirtBeltTieJacket 11 | 12 | 6 | 7 13 |14 1 | 8 2 | 5 3 | 4 9 |10 Undiscovered Active Finished Unfinished

20 20 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket PantsShoesWatchShirtBeltTieJacket 11 | 12 |15 6 | 7 13 |14 1 | 8 2 | 5 3 | 4 9 |10 Undiscovered Active Finished Unfinished

21 21 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket UnderwearPantsShoesWatchShirtBeltTieJacket 11 | |15 6 | 7 13 |14 1 | 8 2 | 5 3 | 4 9 |10 Undiscovered Active Finished Unfinished

22 22 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket UnderwearPantsShoesWatchShirtBeltTieJacket 11 | |15 6 | 7 13 |14 17 | 1 | 8 2 | 5 3 | 4 9 |10 Undiscovered Active Finished Unfinished

23 23 Getting Dressed UnderwearSocks ShoesPants Belt Shirt Watch Tie Jacket SocksUnderwearPantsShoesWatchShirtBeltTieJacket 11 | |15 6 | 7 13 |14 17 | 18 1 | 8 2 | 5 3 | 4 9 |10 Undiscovered Active Finished Unfinished

24 24 Strongly-Connected Graph G is strongly connected if, for every u and v in V, there is some path from u to v and some path from v to u. Strongly Connected Not Strongly Connected

25 25 A strongly connected component (SCC) of G is a maximal set of vertices C V such that for all u, v C, both u v and v u exist. Strongly Connected Components

26 26 G SCC =(V SCC, E SCC ): one vertex for each component –(u, v) E SCC if there exists at least one directed edge from the corresponding components Graph of Strongly Connected Components

27 27 G SCC has a topological ordering Graph of Strongly Connected Components

28 28 1 |128 |1113|16 14|155 | 63 | 4 2 | 79 |10 source vertex d f Tree edgesBack edgesForward edgesCross edges Kinds of Edges B F C C C C C C


Download ppt "1 Directed Acyclic Graph DAG – directed graph with no directed cycles."

Similar presentations


Ads by Google