Class RandomWalkAlgorithm<TVertex, TEdge>
Random walk algorithm (using edge chain).
Inheritance
Inherited Members
Namespace: QuikGraph.Algorithms.RandomWalks
Assembly: QuikGraph.dll
Syntax
public sealed class RandomWalkAlgorithm<TVertex, TEdge> : RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>, IAlgorithm<IImplicitGraph<TVertex, TEdge>>, IComputation, IAlgorithmComponent, ITreeBuilderAlgorithm<TVertex, TEdge> where TEdge : IEdge<TVertex>Type Parameters
| Name | Description | 
|---|---|
| TVertex | Vertex type. | 
| TEdge | Edge type. | 
Constructors
| Improve this Doc View SourceRandomWalkAlgorithm(IImplicitGraph<TVertex, TEdge>)
Initializes a new instance of the RandomWalkAlgorithm<TVertex, TEdge> class.
Declaration
public RandomWalkAlgorithm(IImplicitGraph<TVertex, TEdge> visitedGraph)Parameters
| Type | Name | Description | 
|---|---|---|
| IImplicitGraph<TVertex, TEdge> | visitedGraph | Graph to visit. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
RandomWalkAlgorithm(IImplicitGraph<TVertex, TEdge>, IEdgeChain<TVertex, TEdge>)
Initializes a new instance of the RandomWalkAlgorithm<TVertex, TEdge> class.
Declaration
public RandomWalkAlgorithm(IImplicitGraph<TVertex, TEdge> visitedGraph, IEdgeChain<TVertex, TEdge> edgeChain)Parameters
| Type | Name | Description | 
|---|---|---|
| IImplicitGraph<TVertex, TEdge> | visitedGraph | Graph to visit. | 
| IEdgeChain<TVertex, TEdge> | edgeChain | Edge chain strategy to use. | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.ArgumentNullException | 
 | 
Properties
| Improve this Doc View SourceEdgeChain
Edge chain strategy for the random walk.
Declaration
public IEdgeChain<TVertex, TEdge> EdgeChain { get; set; }Property Value
| Type | Description | 
|---|---|
| IEdgeChain<TVertex, TEdge> | 
EndPredicate
Predicate to prematurely ends the walk.
Declaration
public EdgePredicate<TVertex, TEdge> EndPredicate { get; set; }Property Value
| Type | Description | 
|---|---|
| EdgePredicate<TVertex, TEdge> | 
Methods
| Improve this Doc View SourceGenerate(TVertex)
Generates a random walk with 100 steps.
Declaration
public void Generate(TVertex root)Parameters
| Type | Name | Description | 
|---|---|---|
| TVertex | root | Root vertex. | 
Exceptions
| Type | Condition | 
|---|---|
| VertexNotFoundException | 
 | 
Generate(TVertex, Int32)
Generates a random walk with walkCount steps.
Declaration
public void Generate(TVertex root, int walkCount)Parameters
| Type | Name | Description | 
|---|---|---|
| TVertex | root | Root vertex. | 
| System.Int32 | walkCount | Number of steps for the random walk. | 
Exceptions
| Type | Condition | 
|---|---|
| VertexNotFoundException | 
 | 
InternalCompute()
Algorithm compute step.
Declaration
protected override void InternalCompute()Overrides
Events
| Improve this Doc View SourceEndVertex
Fired when the walk ends.
Declaration
public event VertexAction<TVertex> EndVertexEvent Type
| Type | Description | 
|---|---|
| VertexAction<TVertex> | 
StartVertex
Fired on a starting vertex once before the start of the walk from it.
Declaration
public event VertexAction<TVertex> StartVertexEvent Type
| Type | Description | 
|---|---|
| VertexAction<TVertex> | 
TreeEdge
Fired when an edge is encountered.
Declaration
public event EdgeAction<TVertex, TEdge> TreeEdgeEvent Type
| Type | Description | 
|---|---|
| EdgeAction<TVertex, TEdge> |