public class RandomWalkIterator<V> extends Object implements GraphWalkIterator<V>
| Constructor and Description |
|---|
RandomWalkIterator(IGraph<V,?> graph,
int walkLength) |
RandomWalkIterator(IGraph<V,?> graph,
int walkLength,
long rngSeed)
Construct a RandomWalkIterator for a given graph, with a specified walk length and random number generator seed.
Uses NoEdgeHandling.EXCEPTION_ON_DISCONNECTED - hence exception will be thrown when generating random
walks on graphs with vertices containing having no edges, or no outgoing edges (for directed graphs) |
RandomWalkIterator(IGraph<V,?> graph,
int walkLength,
long rngSeed,
NoEdgeHandling mode) |
RandomWalkIterator(IGraph<V,?> graph,
int walkLength,
long rngSeed,
NoEdgeHandling mode,
int firstVertex,
int lastVertex)
Constructor used to generate random walks starting at a subset of the vertices in the graph.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
hasNext()
Whether the iterator has any more vertex sequences.
|
IVertexSequence<V> |
next()
Get the next vertex sequence.
|
void |
reset()
Reset the graph walk iterator.
|
int |
walkLength()
Length of the walks returned by next()
Note that a walk of length
i contains i+1 vertices |
public RandomWalkIterator(IGraph<V,?> graph, int walkLength, long rngSeed)
NoEdgeHandling.EXCEPTION_ON_DISCONNECTED - hence exception will be thrown when generating random
walks on graphs with vertices containing having no edges, or no outgoing edges (for directed graphs)public RandomWalkIterator(IGraph<V,?> graph, int walkLength, long rngSeed, NoEdgeHandling mode)
graph - IGraph to conduct walks onwalkLength - length of each walk. Walk of length 0 includes 1 vertex, walk of 1 includes 2 vertices etcrngSeed - seed for randomizationmode - mode for handling random walks from vertices with either no edges, or no outgoing edges (for directed graphs)public RandomWalkIterator(IGraph<V,?> graph, int walkLength, long rngSeed, NoEdgeHandling mode, int firstVertex, int lastVertex)
graph - IGraph to conduct walks onwalkLength - length of each walk. Walk of length 0 includes 1 vertex, walk of 1 includes 2 vertices etcrngSeed - seed for randomizationmode - mode for handling random walks from vertices with either no edges, or no outgoing edges (for directed graphs)firstVertex - first vertex index (inclusive) to start random walks fromlastVertex - last vertex index (exclusive) to start random walks frompublic IVertexSequence<V> next()
GraphWalkIteratornext in interface GraphWalkIterator<V>public boolean hasNext()
GraphWalkIteratorhasNext in interface GraphWalkIterator<V>public void reset()
GraphWalkIteratorreset in interface GraphWalkIterator<V>public int walkLength()
GraphWalkIteratori contains i+1 verticeswalkLength in interface GraphWalkIterator<V>Copyright © 2016. All Rights Reserved.