Strongly connected components condensing point + Tarjia +

Tarjan are seemingly with Hopcroft Cornell great God. In general, an observation Tarjan algorithm, namely: a node with the SCC in the DFS necessarily constitute a subtree of the tree. We are looking for SCC, you have to find its root in the DFS tree.

So how do you find them?

Consider, if DFS access to a node u, u came along and settled point v, v but sent out a reverse side, pointing to the precursor w u, that depending on the nature of DFS, u-> v -> w-> u form a ring. This is a bunch of things inevitable in the same SCC. So to find the root of a tree SCC child, you have to find the DFS nodes in the tree first to be discovered, and this node to form a ring with its pile successor node.

This time DFS feature comes in handy. First discovered nodes can be found by recording the time to achieve, and the reverse side may be achieved by determining the color of nodes, i.e. access state. Define a node low values: from the child node of the tree node reachable, yet the earliest access time which belongs to the SCC nodes obtained. Since the SCC sub-tree configuration, it is not required to obtain a junction where the SCC with a stack to characterize it: each visit to a node u, Visit discovery time recording, and pushes it onto the stack go. If you have not visited nodes reachable from u v, v then access, with a low v updates the value of u; otherwise, if v has been visited, it does not look at it in the stack. If, not described in the end which determines v SCC belongs, then (u, v) is a reverse side, the visit in accordance with the value of v, u is updated to a value low. Finally, back to the node u, if u visit the low value and equal, obviously u we are looking for the root node. U from the stack and put it on all nodes pop up, in which a bunch of things in the SCC.

https://blog.csdn.net/sdsy191553/article/details/79674201

Look, I stumbled

Guess you like

Origin www.cnblogs.com/jindui/p/11199070.html