The following pseudocode is the basic depth-first-search algorithm. The input graph G may be undirected or directed. The variable time is a global variable that we use for timestamping. DFS(G) 1 for each vertex u ∈ V [G] 2 do color[u] ← WHITE 3 π[u] ← NIL 4 time ← 0 5...
访问顺序: A, B, D, F, E, C, G. Pseudocode Input: A graphGand a vertexvof G Output: A labeling of the edges in the connected component of v as discovery edges and back edges 1procedureDFS(G,v): 2 labelvas explored 3for alledges e in G.adjacentEdges(v)do4ifedgeeis unexploredt...