1 PROCEDURE (G: reduced graph)
2 Let S(v) be a set of successors of v
3 Let R be an empty set
4
5 //assign integer labels sinks and isolated vertices.
6 FOR each v in G
7 Find S(v) successors of v
8 IF S(v) is assigned to layers
9 Add v to R
10 Remove v from G
11 ENDIF
12 END LOOP
13 END PROCEDURE