org.jgrapht.traverse
Class BreadthFirstIterator<V,E>
- java.lang.Object
-
- org.jgrapht.traverse.AbstractGraphIterator<V,E>
-
- org.jgrapht.traverse.CrossComponentIterator<V,E,java.lang.Object>
-
- org.jgrapht.traverse.BreadthFirstIterator<V,E>
-
- Type Parameters:
V- the graph vertex typeE- the graph edge type
- All Implemented Interfaces:
- java.util.Iterator<V>, GraphIterator<V,E>
public class BreadthFirstIterator<V,E> extends CrossComponentIterator<V,E,java.lang.Object>
A breadth-first iterator for a directed and an undirected graph. For this iterator to work correctly the graph must not be modified during iteration. Currently there are no means to ensure that, nor to fail-fast. The results of such modifications are undefined.- Since:
- Jul 19, 2003
-
-
Constructor Summary
Constructors Constructor and Description BreadthFirstIterator(Graph<V,E> g)Creates a new breadth-first iterator for the specified graph.BreadthFirstIterator(Graph<V,E> g, V startVertex)Creates a new breadth-first iterator for the specified graph.
-
Method Summary
-
Methods inherited from class org.jgrapht.traverse.CrossComponentIterator
getGraph, hasNext, next
-
Methods inherited from class org.jgrapht.traverse.AbstractGraphIterator
addTraversalListener, isCrossComponentTraversal, isReuseEvents, remove, removeTraversalListener, setCrossComponentTraversal, setReuseEvents
-
-
-
-
Constructor Detail
-
BreadthFirstIterator
public BreadthFirstIterator(Graph<V,E> g)
Creates a new breadth-first iterator for the specified graph.- Parameters:
g- the graph to be iterated.
-
BreadthFirstIterator
public BreadthFirstIterator(Graph<V,E> g, V startVertex)
Creates a new breadth-first iterator for the specified graph. Iteration will start at the specified start vertex and will be limited to the connected component that includes that vertex. If the specified start vertex isnull, iteration will start at an arbitrary vertex and will not be limited, that is, will be able to traverse all the graph.- Parameters:
g- the graph to be iterated.startVertex- the vertex iteration to be started.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG