V
- the graph vertex typeE
- the graph edge typepublic class DegeneracyOrderingIterator<V,E> extends AbstractGraphIterator<V,E>
The degeneracy of a graph $G $is the smallest value d such that every nonempty subgraph of $G$ contains a vertex of degree at most $d.$ If a graph has degeneracy $d$, then it has a degeneracy ordering, an ordering such that each vertex has $d$ or fewer neighbors that come later in the ordering.
The iterator crosses components but does not track them, it only tracks visited vertices.
The iterator treats the input graph as undirected even if the graph is directed. Moreover, it completely ignores self-loops, meaning that it operates as if self-loops do not contribute to the degree of a vertex.
crossComponentTraversal, graph, nListeners, reusableEdgeEvent, reusableVertexEvent, reuseEvents
Constructor and Description |
---|
DegeneracyOrderingIterator(Graph<V,E> graph)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
boolean |
isCrossComponentTraversal()
Test whether this iterator is set to traverse the graph across connected components.
|
V |
next() |
void |
setCrossComponentTraversal(boolean crossComponentTraversal)
Sets the cross component traversal flag - indicates whether to traverse the graph across
connected components.
|
addTraversalListener, createEdgeTraversalEvent, createVertexTraversalEvent, fireConnectedComponentFinished, fireConnectedComponentStarted, fireEdgeTraversed, fireVertexFinished, fireVertexTraversed, getGraph, isReuseEvents, remove, removeTraversalListener, setReuseEvents
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public boolean isCrossComponentTraversal()
isCrossComponentTraversal
in interface GraphIterator<V,E>
isCrossComponentTraversal
in class AbstractGraphIterator<V,E>
true
if traverses across connected components, otherwise
false
.public void setCrossComponentTraversal(boolean crossComponentTraversal)
IllegalArgumentException
.setCrossComponentTraversal
in class AbstractGraphIterator<V,E>
crossComponentTraversal
- if true
traverses across connected components.public boolean hasNext()
public V next()
Copyright © 2018. All rights reserved.