code: func DepthFirstWalk(node Node, cb func(n Node) bool) {
  	frontier := []Node{node}
  	seen := make(map[Node]struct{})
  	for len(frontier) > 0 {
  		// Pop the current node
  		n := len(frontier)
  		current := frontier[n-1]
  		frontier = frontier[:n-1]
  
  		// Check for potential cycle
  		if _, ok := seen[current]; ok {
  			continue
  		}
  		seen[current] = struct{}{}
  
  		// Visit with the callback
  		if !cb(current) {
  			continue
  		}
  
  		// Add any new edges to visit, in reverse order
  		edges := current.Edges()
  		for i := len(edges) - 1; i >= 0; i-- {
  			frontier = append(frontier, edges[i].Tail())
  		}
  	}
  }
docs: // DepthFirstWalk performs a depth-first traversal of the nodes
  // that can be reached from the initial input set. The callback is
  // invoked for each visited node, and may return false to prevent
  // vising any children of the current node