Tarjan algorithm pseudo-code

Fake code:

Stack: current point on the path dfs 
Low [x]: the point x that can be reached in a minimum DFN


dfs (x, T)
    x-stack
    DFN [x] = T
    Low [x] = T
    for (x, Y)
        IF (VIS [Y]!)
            DFS (Y, T +. 1), Low [X] = min (Low [X], Low [Y]);
        the else
            IF (Y in the stack (on the path))
                Low [ x] = min (Low [x], Low [Y])
    IF (Low [x] = DFN [x])
        to the stack to x

 

Guess you like

Origin www.cnblogs.com/Tidoblogs/p/11221772.html