Interface GraphTraversalVisitor<N,​E,​D>

  • Type Parameters:
    N - node class
    E - edge class
    D - user data class
    All Known Implementing Classes:
    TarjanSCCVisitor

    public interface GraphTraversalVisitor<N,​E,​D>
    Visitor interface for graph traversals.

    This interface declares methods that are called upon basic graph traversal actions.

    • Method Detail

      • processInitial

        default GraphTraversalAction processInitial​(N initialNode,
                                                    Holder<D> holder)
        Called when the initial nodes (as passed to the traversal method) are processed.
        Parameters:
        initialNode - the node that is processed
        holder - a writable reference whose (node-specific) data is passed to the corresponding methods during traversal
        Returns:
        the action to perform
      • startExploration

        default boolean startExploration​(N node,
                                         D data)
        Called when the exploration of a node is started.
        Parameters:
        node - the node whose exploration is about to be started
        data - the user data associated with this node
        Returns:
        true, if the node should be explored, false otherwise
      • processEdge

        default GraphTraversalAction processEdge​(N srcNode,
                                                 D srcData,
                                                 E edge,
                                                 N tgtNode,
                                                 Holder<D> tgtHolder)
        Called when an edge is processed.
        Parameters:
        srcNode - the source node
        srcData - the user data associated with the source node
        edge - the edge that is being processed
        tgtNode - the target node
        tgtHolder - a writable reference to provide user data that should be associated with the target node
        Returns:
        the action to perform
      • backtrackEdge

        default void backtrackEdge​(N srcNode,
                                   D srcData,
                                   E edge,
                                   N tgtNode,
                                   D tgtData)
        Called when an edge is backtracked. This typically happens only in depth-first style traversals.
        Parameters:
        srcNode - the source node
        srcData - the user data associated with the source node
        edge - the edge that is being processed
        tgtNode - the target node
        tgtData - the user data associated with the target node
      • finishExploration

        default void finishExploration​(N node,
                                       D data)
        Called when the exploration of a node is finished.
        Parameters:
        node - the node whose exploration is being finished
        data - the user data associated with this node