net.sourceforge.combean.interfaces.graph.alg.traverse
Interface TraversalVisitor

Package class diagram package TraversalVisitor
All Known Subinterfaces:
DFSVisitor
All Known Implementing Classes:
ConstructPredMapVisitor, DFSFinishedNodeOnStackVisitor, DFSNodeNumberingVisitor, DFSNodeStackVisitor, IdleDFSVisitor, IdleTraversalVisitor, NodeCountVisitor, PartitionsTraversalVisitor

public interface TraversalVisitor

Helper object for graph traversal algorithms.

See Also:
GraphAlgorithm

Method Summary
 void finish()
          This method is called when the traversal is terminated.
 void init(Graph g)
          This method is called immediately before the traversal algorithm starts if all components of g shall be traversed.
 void initLocal(Graph g, Node startNode)
          This method is called immediately before the traversal algorithm starts if a component of g shall be traversed from a local start node.
 void leaveComponent(Node v)
          The traversal algorithm has finished visiting a component of the graph.
 void openNeighbor(Edge e, Node from)
          A node has been detected for the first time.
 boolean readyToTerminate()
          Signal if the traversal can be terminated.
 void reopenNeighbor(Edge e, Node from)
          A node has been redetected
 void visitComponent(Node v)
          The traversal algorithms starts visiting a component of the graph.
 void visitNode(Node v)
          The traversal algorithms begins to explore the neighborhood of a node.
 

Method Detail

readyToTerminate

boolean readyToTerminate()
Signal if the traversal can be terminated. Note that this is only a suggestion to the traversal algorithm.

Returns:
true if termination is possible.

openNeighbor

void openNeighbor(Edge e,
                  Node from)
A node has been detected for the first time.

Parameters:
e - the edge through which the node has been detected.
from - the other node from where the new node has been detected.

reopenNeighbor

void reopenNeighbor(Edge e,
                    Node from)
A node has been redetected

Parameters:
e - the edge through which the node has been detected.
from - the other node from where the node has been detected.

visitNode

void visitNode(Node v)
The traversal algorithms begins to explore the neighborhood of a node.

Parameters:
v - the node which is being visited.

visitComponent

void visitComponent(Node v)
The traversal algorithms starts visiting a component of the graph. This is also called (exactly once) when the traversal starts from a local start node.

Parameters:
v - an arbitrary node in the component.

leaveComponent

void leaveComponent(Node v)
The traversal algorithm has finished visiting a component of the graph. This is also called (exactly once) when the traversal starts from a local start node.

Parameters:
v - an arbitrary node in the component.

init

void init(Graph g)
This method is called immediately before the traversal algorithm starts if all components of g shall be traversed.

Parameters:
g - the graph which will be traversed.

initLocal

void initLocal(Graph g,
               Node startNode)
This method is called immediately before the traversal algorithm starts if a component of g shall be traversed from a local start node.

Parameters:
g - the graph which will be traversed.
startNode - the local start node.

finish

void finish()
This method is called when the traversal is terminated.