Package com.gengoai.graph.algorithms
Class RandomWalk<V>
- java.lang.Object
-
- com.gengoai.graph.algorithms.RandomWalk<V>
-
- Type Parameters:
V
- the type parameter
- All Implemented Interfaces:
GraphTraversal<V>
,Serializable
public class RandomWalk<V> extends Object implements GraphTraversal<V>, Serializable
Performs a random walk over the vertices in the graph. If the graph is weighted, the next vertex is randomly selected proportional to the successor vertices' weight. If the graph is not weighted, the next vertex is uniformly randomly selected.
- Author:
- David B. Bracewell
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RandomWalk(Graph<V> graph)
Default Constructor testPath(source);RandomWalk(Graph<V> graph, boolean isWeighted)
Default Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<V>
iterator(V startingVertex)
An iterator to traverse the graph starting at the given vertexV
walk(V startingVertex, int numberOfSteps)
Selecte a vertex by taking a given number of steps from the starting vertex
-
-
-
Method Detail
-
iterator
public Iterator<V> iterator(V startingVertex)
Description copied from interface:GraphTraversal
An iterator to traverse the graph starting at the given vertex- Specified by:
iterator
in interfaceGraphTraversal<V>
- Parameters:
startingVertex
- the starting point- Returns:
- the iterator
-
-