|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.geotools.graph.traverse.basic.AbstractGraphIterator org.geotools.graph.traverse.basic.SourceGraphIterator org.geotools.graph.traverse.standard.BreadthFirstIterator
Iterates over the nodes of a graph in a Breadth First Search pattern
starting from a specified node. The following illustrates the iteration
order.
The iteration operates by maintaning a node queue of active nodes.
An active node is a node that will returned at a later stage of the i
teration. The node queue for a Breadth First iteration is implemented as a
First In First Out queue.
A node is placed in the the node queue if it has not been visited, and
it is adjacent to a a node that has been visited. The node queue intially
contains only the source node of the traversal.
Constructor Summary | |
BreadthFirstIterator()
|
Method Summary | |
protected Queue |
buildQueue(Graph graph)
Builds the node queue for the iteration. |
void |
cont(Graphable current,
GraphTraversal traversal)
Looks for nodes adjacent to the current node to place into the node queue. |
protected Queue |
getQueue()
Returns the node queue. |
void |
init(Graph graph,
GraphTraversal traversal)
Does nothing. |
void |
killBranch(Graphable current,
GraphTraversal traversal)
Kills the current branch by not looking for any adjacent nodes to place into the node queue. |
Graphable |
next(GraphTraversal traversal)
Returns the next node from the node queue that has not yet been visited. |
void |
setSource(Graphable source)
Sets the source of the traversal and places it in the node queue. |
Methods inherited from class org.geotools.graph.traverse.basic.SourceGraphIterator |
getSource |
Methods inherited from class org.geotools.graph.traverse.basic.AbstractGraphIterator |
getGraph, getTraversal, getWalker, setTraversal |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public BreadthFirstIterator()
Method Detail |
public void setSource(Graphable source)
setSource
in class SourceGraphIterator
source
- The source of the iteration.SourceGraphIterator.setSource(Graphable)
public void init(Graph graph, GraphTraversal traversal)
graph
- The graph being whose components are being iterated over.org.geotools.graph.traverse.GraphIterator#init(Graph)
public Graphable next(GraphTraversal traversal)
org.geotools.graph.traverse.GraphIterator#next()
public void cont(Graphable current, GraphTraversal traversal)
current
- The current component of the traversal.org.geotools.graph.traverse.GraphIterator#cont(Graphable)
public void killBranch(Graphable current, GraphTraversal traversal)
current
- The current component of the traversal.org.geotools.graph.traverse.GraphIterator#killBranch(Graphable)
protected Queue buildQueue(Graph graph)
graph
- The graph being iterated over.
protected Queue getQueue()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |