Topological sort: Difference between revisions

Content added Content deleted
(→‎{{header|Java}}: adjacency entries are only 1 or 0, so are booleans)
Line 4,703: Line 4,703:
<lang zkl>fcn topoSort(data){ // data is L( L(root,L(leaves)),...)
<lang zkl>fcn topoSort(data){ // data is L( L(root,L(leaves)),...)
allDs:=data.pump(List,fcn(rds){ T(Void.Write,Void.Write,rds[1]) }).copy();
allDs:=data.pump(List,fcn(rds){ T(Void.Write,Void.Write,rds[1]) }).copy();
roots:=D(data); // dictionary of root:leaves
roots:=Dictionary(data); // dictionary of root:leaves
L:=List();
L:=List();
S:=data.pump(List,'wrap([(r,_)]){ if(allDs.holds(r)) Void.Skip else r }).copy();
S:=data.pump(List,'wrap([(r,_)]){ if(allDs.holds(r)) Void.Skip else r }).copy();