DataStructure Graph Traversal
Zhejiang University
DFS(Depth First Search)
1 | void DFS(Vertex V){ |
Complexity
Adjacent List:
Adjacent Matrix:
BFS(Breadth First Search)
1 | void BFS(Vertex V){ |
Complexity
Adjacent List:
Adjacent Matrix:
Problem: Disconnected Graph
Connected Component: Extreme large subGraph of a undirected graph.
- Extreme large number of vertexes
- Extreme large number of edges
Strongly Connected: V and W are connected in both directions.
- Remark: The 2 paths need not be the same!
Strongly Connected Graph: Any given pair of vertexes are strongly connected.
Strongly Connected Component: Extreme large subGraph of a directed graph.
1 | void ListComponents(Graph G){ |