Show / Hide Table of Contents

Class RandomWalkAlgorithm<TVertex, TEdge>

Random walk algorithm (using edge chain).

Inheritance
System.Object
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>
RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>
RandomWalkAlgorithm<TVertex, TEdge>
Implements
IAlgorithm<IImplicitGraph<TVertex, TEdge>>
IComputation
IAlgorithmComponent
ITreeBuilderAlgorithm<TVertex, TEdge>
Inherited Members
RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>.TryGetRootVertex(TVertex)
RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>.SetRootVertex(TVertex)
RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>.ClearRootVertex()
RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>.RootVertexChanged
RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>.OnRootVertexChanged(EventArgs)
RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>.GetAndAssertRootInGraph()
RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>.AssertRootInGraph(TVertex)
RootedAlgorithmBase<TVertex, IImplicitGraph<TVertex, TEdge>>.Compute(TVertex)
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.SyncRoot
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.State
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.Compute()
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.Abort()
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.StateChanged
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.OnStateChanged(EventArgs)
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.Started
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.OnStarted(EventArgs)
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.Finished
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.OnFinished(EventArgs)
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.Aborted
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.OnAborted(EventArgs)
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.VisitedGraph
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.Services
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.GetService<T>()
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.TryGetService<T>(T)
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.TryGetService(Type, Object)
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.ThrowIfCancellationRequested()
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.Initialize()
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.InternalCompute()
AlgorithmBase<IImplicitGraph<TVertex, TEdge>>.Clean()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
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 Source

RandomWalkAlgorithm(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

visitedGraph is null.

| Improve this Doc View Source

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

visitedGraph is null.

System.ArgumentNullException

edgeChain is null.

Properties

| Improve this Doc View Source

EdgeChain

Edge chain strategy for the random walk.

Declaration
public IEdgeChain<TVertex, TEdge> EdgeChain { get; set; }
Property Value
Type Description
IEdgeChain<TVertex, TEdge>
| Improve this Doc View Source

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 Source

Generate(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

root is not part of VisitedGraph.

| Improve this Doc View Source

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

root is not part of VisitedGraph.

| Improve this Doc View Source

InternalCompute()

Algorithm compute step.

Declaration
protected override void InternalCompute()
Overrides
QuikGraph.Algorithms.AlgorithmBase<QuikGraph.IImplicitGraph<TVertex, TEdge>>.InternalCompute()

Events

| Improve this Doc View Source

EndVertex

Fired when the walk ends.

Declaration
public event VertexAction<TVertex> EndVertex
Event Type
Type Description
VertexAction<TVertex>
| Improve this Doc View Source

StartVertex

Fired on a starting vertex once before the start of the walk from it.

Declaration
public event VertexAction<TVertex> StartVertex
Event Type
Type Description
VertexAction<TVertex>
| Improve this Doc View Source

TreeEdge

Fired when an edge is encountered.

Declaration
public event EdgeAction<TVertex, TEdge> TreeEdge
Event Type
Type Description
EdgeAction<TVertex, TEdge>

Implements

IAlgorithm<TGraph>
IComputation
IAlgorithmComponent
ITreeBuilderAlgorithm<TVertex, TEdge>

Extension Methods

GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, String, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter)
GraphMLExtensions.SerializeToGraphML<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, XmlReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeFromGraphML<TVertex, TEdge, TGraph>(TGraph, String, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
GraphMLExtensions.DeserializeAndValidateFromGraphML<TVertex, TEdge, TGraph>(TGraph, TextReader, IdentifiableVertexFactory<TVertex>, IdentifiableEdgeFactory<TVertex, TEdge>)
SerializationExtensions.SerializeToXml<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>, String, String, String, String)
SerializationExtensions.SerializeToXml<TVertex, TEdge, TGraph>(TGraph, XmlWriter, VertexIdentity<TVertex>, EdgeIdentity<TVertex, TEdge>, String, String, String, String, Action<XmlWriter, TGraph>, Action<XmlWriter, TVertex>, Action<XmlWriter, TEdge>)
  • Improve this Doc
  • View Source
In This Article
Back to top QuikGraph