Content deleted Content added
Netzwerkerin (talk | contribs) →Graph traversal algorithms: added a nice visual of three algorithms to traverse a graph. |
|||
Line 14:
==Graph traversal algorithms==
Note. — If each vertex in a graph is to be traversed by a tree-based algorithm (such as DFS or BFS), then the algorithm must be called at least once for each [[connected component (graph theory)|connected component]] of the graph. This is easily accomplished by iterating through all the vertices of the graph, performing the algorithm on each vertex that is still unvisited when examined.
[[File:Graph-scan.png|thumb|A non-verbal description of three graph traversal algorithms: randomly, depth-first search, and breadth-first search.]]
===Depth-first search===
|