Class WeightedRandomWalkIterator<V>
- java.lang.Object
-
- org.deeplearning4j.graph.iterator.WeightedRandomWalkIterator<V>
-
- All Implemented Interfaces:
GraphWalkIterator<V>
public class WeightedRandomWalkIterator<V> extends Object implements GraphWalkIterator<V>
-
-
Constructor Summary
Constructors Constructor Description WeightedRandomWalkIterator(IGraph<V,? extends Number> graph, int walkLength)
WeightedRandomWalkIterator(IGraph<V,? extends Number> graph, int walkLength, long rngSeed)
Construct a RandomWalkIterator for a given graph, with a specified walk length and random number generator seed.
UsesNoEdgeHandling.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)WeightedRandomWalkIterator(IGraph<V,? extends Number> graph, int walkLength, long rngSeed, NoEdgeHandling mode)
WeightedRandomWalkIterator(IGraph<V,? extends Number> 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 lengthi
containsi+1
vertices
-
-
-
Constructor Detail
-
WeightedRandomWalkIterator
public WeightedRandomWalkIterator(IGraph<V,? extends Number> graph, int walkLength)
-
WeightedRandomWalkIterator
public WeightedRandomWalkIterator(IGraph<V,? extends Number> graph, int walkLength, long rngSeed)
Construct a RandomWalkIterator for a given graph, with a specified walk length and random number generator seed.
UsesNoEdgeHandling.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)
-
WeightedRandomWalkIterator
public WeightedRandomWalkIterator(IGraph<V,? extends Number> graph, int walkLength, long rngSeed, NoEdgeHandling mode)
- Parameters:
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)
-
WeightedRandomWalkIterator
public WeightedRandomWalkIterator(IGraph<V,? extends Number> 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. Order of starting vertices is randomized within this subset- Parameters:
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 from
-
-
Method Detail
-
next
public IVertexSequence<V> next()
Description copied from interface:GraphWalkIterator
Get the next vertex sequence.- Specified by:
next
in interfaceGraphWalkIterator<V>
-
hasNext
public boolean hasNext()
Description copied from interface:GraphWalkIterator
Whether the iterator has any more vertex sequences.- Specified by:
hasNext
in interfaceGraphWalkIterator<V>
-
reset
public void reset()
Description copied from interface:GraphWalkIterator
Reset the graph walk iterator.- Specified by:
reset
in interfaceGraphWalkIterator<V>
-
walkLength
public int walkLength()
Description copied from interface:GraphWalkIterator
Length of the walks returned by next() Note that a walk of lengthi
containsi+1
vertices- Specified by:
walkLength
in interfaceGraphWalkIterator<V>
-
-