type BreadthFirst … // Walk performs a breadth-first traversal of the graph g starting from the given node, // depending on the EdgeFilter field and the until parameter if they are non-nil. The // traversal follows edges for which EdgeFilter(edge) is true and returns the first node // for which until(node, depth) is true. During the traversal, if the Visit field is // non-nil, it is called with the nodes joined by each followed edge. func (b *BreadthFirst) Walk(g graph.Graph, from graph.Node, until func(n graph.Node, d int) bool) graph.Node { … } // WalkAll calls Walk for each unvisited node of the graph g using edges independent // of their direction. The functions before and after are called prior to commencing // and after completing each walk if they are non-nil respectively. The function // during is called on each node as it is traversed. func (b *BreadthFirst) WalkAll(g graph.Undirected, before, after func(), during func(graph.Node)) { … } // Visited returned whether the node n was visited during a traverse. func (b *BreadthFirst) Visited(n graph.Node) bool { … } // Reset resets the state of the traverser for reuse. func (b *BreadthFirst) Reset() { … } type DepthFirst … // Walk performs a depth-first traversal of the graph g starting from the given node, // depending on the EdgeFilter field and the until parameter if they are non-nil. The // traversal follows edges for which EdgeFilter(edge) is true and returns the first node // for which until(node) is true. During the traversal, if the Visit field is non-nil, it // is called with the nodes joined by each followed edge. func (d *DepthFirst) Walk(g graph.Graph, from graph.Node, until func(graph.Node) bool) graph.Node { … } // WalkAll calls Walk for each unvisited node of the graph g using edges independent // of their direction. The functions before and after are called prior to commencing // and after completing each walk if they are non-nil respectively. The function // during is called on each node as it is traversed. func (d *DepthFirst) WalkAll(g graph.Undirected, before, after func(), during func(graph.Node)) { … } // Visited returned whether the node n was visited during a traverse. func (d *DepthFirst) Visited(n graph.Node) bool { … } // Reset resets the state of the traverser for reuse. func (d *DepthFirst) Reset() { … }