Some basic facts about disjoint where the first element is a set and the second one a list

x is connected to y avoiding elements of l

x is biconnected to y avoiding the elements of s

Canonical element in a list : find the first element of l1 that is equivalent to x avoiding l2

well formed list : rconnected elements are inside and canonical elements are on top

Removing the equivalent elements of the top preserve well-formedness

Computing the connected elements for the reversed graph gives the equivalent class of the top element of an well_formed list

Computing well_formed list by accumulation

Computing well_formed list by accumulation

Building the stack of all nodes

The stack is well-formed and contains all the nodes

Kosaraju algorithm

save script