1 PROCEDURE (G: proper digraph)
2 Let R be a set of vertices
3 Let E be a set of edges between layer i and (i+1)
4 Let crossings be a integer
5
6 CALL computeBaryCenter with G RETURN R
7 Sort R based on barycentric value
8 FOR each e in E
9 Remove e from E
10 FOR each e1 from E
11 crossings = crossings + crossing between e and e1
12 END LOOP
13 END LOOP
14 END PROCEDURE