V
 vertex typeE
 edge typeD
 type of data associated to seen verticespublic abstract class CrossComponentIterator<V,E,D> extends AbstractGraphIterator<V,E>
crossComponentTraversal, graph, nListeners, reusableEdgeEvent, reusableVertexEvent, reuseEvents
Constructor and Description 

CrossComponentIterator(Graph<V,E> g)
Creates a new iterator for the specified graph.

CrossComponentIterator(Graph<V,E> g,
Iterable<V> startVertices)
Creates a new iterator for the specified graph.

CrossComponentIterator(Graph<V,E> g,
V startVertex)
Creates a new iterator for the specified graph.

Modifier and Type  Method and Description 

protected abstract void 
encounterVertex(V vertex,
E edge)
Update data structures the first time we see a vertex.

protected abstract void 
encounterVertexAgain(V vertex,
E edge)
Called whenever we reencounter a vertex.

protected void 
finishVertex(V vertex)
Called when a vertex has been finished (meaning is dependent on traversal represented by
subclass).

protected D 
getSeenData(V vertex)
Access the data stored for a seen vertex.

boolean 
hasNext() 
protected abstract boolean 
isConnectedComponentExhausted()
Returns true if there are no more uniterated vertices in the currently iterated
connected component; false otherwise.

protected boolean 
isSeenVertex(V vertex)
Determines whether a vertex has been seen yet by this traversal.

V 
next() 
protected abstract V 
provideNextVertex()
Returns the vertex to be returned in the following call to the iterator
next
method. 
protected D 
putSeenData(V vertex,
D data)
Stores iteratordependent data for a vertex that has been seen.

addTraversalListener, createEdgeTraversalEvent, createVertexTraversalEvent, fireConnectedComponentFinished, fireConnectedComponentStarted, fireEdgeTraversed, fireVertexFinished, fireVertexTraversed, getGraph, isCrossComponentTraversal, isReuseEvents, remove, removeTraversalListener, setCrossComponentTraversal, setReuseEvents
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public CrossComponentIterator(Graph<V,E> g)
g
 the graph to be iteratedpublic CrossComponentIterator(Graph<V,E> g, V startVertex)
null
, Iteration will start at an arbitrary graph vertex.g
 the graph to be iterated.startVertex
 the vertex iteration to be started.IllegalArgumentException
 if g==null
or does not contain
startVertex
public CrossComponentIterator(Graph<V,E> g, Iterable<V> startVertices)
null
, Iteration will start at an arbitrary graph vertex.g
 the graph to be iterated.startVertices
 the vertices iteration to be started.IllegalArgumentException
 if g==null
or does not contain
startVertex
public boolean hasNext()
public V next()
protected abstract boolean isConnectedComponentExhausted()
protected abstract void encounterVertex(V vertex, E edge)
vertex
 the vertex encounterededge
 the edge via which the vertex was encountered, or null if the vertex is a
starting pointprotected abstract V provideNextVertex()
next
method.protected D getSeenData(V vertex)
vertex
 a vertex which has already been seen.null
if no data was associated
with the vertex. A null
return can also indicate that the vertex was
explicitly associated with
null
.protected boolean isSeenVertex(V vertex)
vertex
 vertex in questionprotected abstract void encounterVertexAgain(V vertex, E edge)
vertex
 the vertex reencounterededge
 the edge via which the vertex was reencounteredprotected D putSeenData(V vertex, D data)
vertex
 a vertex which has been seen.data
 data to be associated with the seen vertex.
null
if no data was associated with the vertex. A
null
return can also indicate that the vertex was explicitly associated with
null
.protected void finishVertex(V vertex)
vertex
 vertex which has been finishedCopyright © 2018. All rights reserved.