# chickadee » graph-bfs » graph-bfs-fold

##### Identifier search
graph-bfs-fold:procedure

Breadth-first search iterator with state; given a list of initial nodes, ROOTS, and initial node state and edge state, NODE-INIT and EDGE-INIT the successors of each initial node are visited in breadth-first search order, and procedures FNODE and FEDGE are applied to each node and the node state, or edge and the edge state, respectively, as the graph is traversed. FNODE is of the form LAMBDA N NODE-STATE -> NODE-STATE where N is node number, and NODE-STATE can be of arbitrary type and must of the same type as NODE-INIT. FEDGE is of the form LAMBDA EDGE EDGE-STATE 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; EDGE-STATE must be of the same type as EDGE-INIT