Download presentation
Presentation is loading. Please wait.
Published bySara Briana Lindsey Modified over 6 years ago
1
Tracing An Algorithm for Strongly Connected Components that uses Depth First Search Graph obtained from Text, page a-al: Geetika Tewari
2
Initial Graph: Directed, multiple edges
3
DFS started: All vertices are labeled sequentially in postorder
Above, finished visiting vertex 1 first
4
Finished visiting vertex 2
5
Finished visiting vertex 3
6
Finished visiting vertex 4
7
Finished visiting vertex 5
Finished visiting vertex 5. Now have to pick a new vertex to start DFS from.
8
Started DFS at a new vertex. Now finished visiting vertex 6
9
Finished visiting vertex 7
10
Finished visiting vertex 8
11
Finished visiting vertex 9
12
Finished visiting vertex 10.
Notice: Entire graph has been visited and all nodes are labeled in post order
13
Inverse Digraph: all directed edges have been reversed
14
Start DFS in the reverse graph, starting at the highest numbered vertex.
Above: DFS started at vertex 10. Could only visit 2 other nodes. Have to choose the next highest numbered vertex
15
Next started DFS at vertex labeled 7. Could only visit one other vertex. Have to resume DFS on the next highest numbered vertex.
16
Resumed DFS on vertex 5. Could visit 3 other vertices
17
Resumed DFS on vertex 1. Finished traversing the entire graph.
18
The result is a forest. In this case, a forest of 4 trees, each is a strongly connected component of the original graph. Strongly connected means every two vertices are reachable from each other. Strongly connected components only exist in the context of directed graphs. 1 3 A Forest 2 4
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.