type VisitableGraph … type VisitingDepthFirst … // 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 *VisitingDepthFirst) Walk(g VisitableGraph, from graph.Node, until func(graph.Node) bool) graph.Node { … } // Visited returned whether the node n was visited during a traverse. func (d *VisitingDepthFirst) Visited(n graph.Node) bool { … } // Reset resets the state of the traverser for reuse. func (d *VisitingDepthFirst) Reset() { … }