Interface GraphTraversalVisitor<N,E,D>
-
- Type Parameters:
N
- node classE
- edge classD
- 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 Summary
All Methods Instance Methods Default Methods Modifier and Type Method Description default void
backtrackEdge(N srcNode, D srcData, E edge, N tgtNode, D tgtData)
Called when an edge is backtracked.default void
finishExploration(N node, D data)
Called when the exploration of a node is finished.default GraphTraversalAction
processEdge(N srcNode, D srcData, E edge, N tgtNode, Holder<D> tgtHolder)
Called when an edge is processed.default GraphTraversalAction
processInitial(N initialNode, Holder<D> holder)
Called when the initial nodes (as passed to the traversal method) are processed.default boolean
startExploration(N node, D data)
Called when the exploration of a node is started.
-
-
-
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 processedholder
- 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 starteddata
- 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 nodesrcData
- the user data associated with the source nodeedge
- the edge that is being processedtgtNode
- the target nodetgtHolder
- 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 nodesrcData
- the user data associated with the source nodeedge
- the edge that is being processedtgtNode
- the target nodetgtData
- the user data associated with the target node
-
-