I'm studying Tarjan's algorithm for strongly-connected components and the way it works is clear to me. Anyway there's a line I don't understand:
// Consider successors of v
for each (v, w) in E do
if (w.index is undefined) then
// Successor w has not yet been visited; recurse on it
strongconnect(w)
v.lowlink := min(v.lowlink, w.lowlink)
else if (w.onStack) then
// Successor w is in stack S and hence in the current SCC
v.lowlink := min(v.lowlink, w.index) // *************
end if
end for
I marked the line with asterisks. Why should we take the discovery index/time of a node when encountering a back-edge
v.lowlink := min(v.lowlink, w.index)
rather than just grabbing its component value?
v.lowlink := min(v.lowlink, w.lowlink)
I can't think of a case where this would be a problem.
Can someone enlighten me please? Edit: I suspect this is only a semantic requirement, i.e. lowlink being defined as the earliest ancestor reachable from the node with only one back-edge, but this is just a wild guess.