mirror of
https://github.com/gonum/gonum.git
synced 2025-10-05 15:16:59 +08:00

The Visit function was originally intended to allow the user to visit nodes with an understanding of the path which edge was used to reach the node. This was misguided because it implies the existence of an invariant that does not exist; every edge into a node is passed to Visit as its node end points. This does not happen because Visit is only called after the node being traverse to is tested for having been visited, leading to surprising behaviour. So this change makes Visit only consider the visited node. The function that was originally intended to be provided by Visit is not given by the Traverse function — previously EdgeFilter — which is called prior to the node's visited status test. The node's visited status can be determined via the walker's Visited method if needed. To avoid painting the edge visiting method as purely a filter, it is renamed Traverse.