Content deleted Content added
→The algorithm in pseudocode: This should make more sense. |
|||
Line 11:
== The algorithm in [[pseudocode]] ==
Input: Graph G = (V, E)
index = 0 // DFS node number counter
S = empty // An empty stack of nodes
forall v in V do
tarjan(v0) // Start a DFS at the start node▼
if (v.index is undefined) // Start a DFS at each node
procedure tarjan(v)
v.index = index // Set the depth index for v
v.lowlink = index
index = index + 1
S.push(v) // Push v on the stack
forall (v, v') in E do // Consider successors of v
if (v'.index is undefined
if (v'.index is undefined) // Was successor v' visited?
tarjan(v') // Recurse
v.lowlink = min(v.lowlink, v'.lowlink)
if (v.lowlink == v.index) // Is v the root of an SCC?▼
▲ if (v.lowlink == v.index) // Is v the root of an SCC?
print "SCC:"
repeat
|