chickadee » graph-bfs » foreach

foreach:procedure

Breadth-first search iterator; given a list of initial nodes, ROOTS, the successors of each initial node are visited in breadth-first search order, and procedures FNODE and FEDGE are applied to each node or edge, respectively, as the graph is traversed. FNODE is of the form LAMBDA N -> _ where N is node number; and FEDGE is of the form LAMBDA EDGE where EDGE is a list of the form (I J INFO); I and J are the nodes defining the edge, and INFO is edge metadata.