Show / Hide Table of Contents

Class RootedAlgorithmBase<TVertex, TGraph>

Base class for all graph algorithm requiring a starting vertex (root).

Inheritance
System.Object
AlgorithmBase<TGraph>
RootedAlgorithmBase<TVertex, TGraph>
EulerianTrailAlgorithm<TVertex, TEdge>
CloneableVertexGraphExplorerAlgorithm<TVertex, TEdge>
CyclePoppingRandomTreeAlgorithm<TVertex, TEdge>
RandomWalkAlgorithm<TVertex, TEdge>
RankedShortestPathAlgorithmBase<TVertex, TEdge, TGraph>
RootedSearchAlgorithmBase<TVertex, TGraph>
BidirectionalDepthFirstSearchAlgorithm<TVertex, TEdge>
BreadthFirstSearchAlgorithm<TVertex, TEdge>
DepthFirstSearchAlgorithm<TVertex, TEdge>
EdgeDepthFirstSearchAlgorithm<TVertex, TEdge>
ImplicitDepthFirstSearchAlgorithm<TVertex, TEdge>
ImplicitEdgeDepthFirstSearchAlgorithm<TVertex, TEdge>
UndirectedBreadthFirstSearchAlgorithm<TVertex, TEdge>
UndirectedDepthFirstSearchAlgorithm<TVertex, TEdge>
ShortestPathAlgorithmBase<TVertex, TEdge, TGraph>
UndirectedShortestPathAlgorithmBase<TVertex, TEdge>
TarjanOfflineLeastCommonAncestorAlgorithm<TVertex, TEdge>
Implements
IAlgorithm<TGraph>
IComputation
IAlgorithmComponent
Inherited Members
AlgorithmBase<TGraph>.SyncRoot
AlgorithmBase<TGraph>.State
AlgorithmBase<TGraph>.Compute()
AlgorithmBase<TGraph>.Abort()
AlgorithmBase<TGraph>.StateChanged
AlgorithmBase<TGraph>.OnStateChanged(EventArgs)
AlgorithmBase<TGraph>.Started
AlgorithmBase<TGraph>.OnStarted(EventArgs)
AlgorithmBase<TGraph>.Finished
AlgorithmBase<TGraph>.OnFinished(EventArgs)
AlgorithmBase<TGraph>.Aborted
AlgorithmBase<TGraph>.OnAborted(EventArgs)
AlgorithmBase<TGraph>.VisitedGraph
AlgorithmBase<TGraph>.Services
AlgorithmBase<TGraph>.GetService<T>()
AlgorithmBase<TGraph>.TryGetService<T>(T)
AlgorithmBase<TGraph>.TryGetService(Type, Object)
AlgorithmBase<TGraph>.ThrowIfCancellationRequested()
AlgorithmBase<TGraph>.Initialize()
AlgorithmBase<TGraph>.InternalCompute()
AlgorithmBase<TGraph>.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
Assembly: QuikGraph.dll
Syntax
[Serializable]
public abstract class RootedAlgorithmBase<TVertex, TGraph> : AlgorithmBase<TGraph>, IAlgorithm<TGraph>, IComputation, IAlgorithmComponent where TGraph : IImplicitVertexSet<TVertex>
Type Parameters
Name Description
TVertex

Vertex type.

TGraph

Graph type.

Remarks

Requires a starting vertex (root).

Constructors

| Improve this Doc View Source

RootedAlgorithmBase(IAlgorithmComponent, TGraph)

Initializes a new instance of the RootedAlgorithmBase<TVertex, TGraph> class.

Declaration
protected RootedAlgorithmBase(IAlgorithmComponent host, TGraph visitedGraph)
Parameters
Type Name Description
IAlgorithmComponent host

Host to use if set, otherwise use this reference.

TGraph visitedGraph

Graph to visit.

Exceptions
Type Condition
System.ArgumentNullException

visitedGraph is null.

Methods

| Improve this Doc View Source

AssertRootInGraph(TVertex)

Asserts that the given root vertex is in the VisitedGraph.

Declaration
protected void AssertRootInGraph(TVertex root)
Parameters
Type Name Description
TVertex root

Vertex to check.

Exceptions
Type Condition
VertexNotFoundException

If the set root vertex is not part of the VisitedGraph.

| Improve this Doc View Source

ClearRootVertex()

Clears the root vertex.

Declaration
public void ClearRootVertex()
| Improve this Doc View Source

Compute(TVertex)

Runs the algorithm with the given root vertex.

Declaration
public virtual void Compute(TVertex root)
Parameters
Type Name Description
TVertex root

Root vertex.

Exceptions
Type Condition
System.ArgumentNullException

root is null.

System.ArgumentException

root is not part of VisitedGraph.

System.InvalidOperationException

Something went wrong when running the algorithm.

| Improve this Doc View Source

GetAndAssertRootInGraph()

Gets the root vertex if set and checks it is part of the VisitedGraph.

Declaration
protected TVertex GetAndAssertRootInGraph()
Returns
Type Description
TVertex

Root vertex.

Exceptions
Type Condition
System.InvalidOperationException

If the root vertex has not been set.

VertexNotFoundException

If the set root vertex is not part of the VisitedGraph.

| Improve this Doc View Source

OnRootVertexChanged(EventArgs)

Called on each root vertex change.

Declaration
protected virtual void OnRootVertexChanged(EventArgs args)
Parameters
Type Name Description
System.EventArgs args

EventArgs.Empty.

| Improve this Doc View Source

SetRootVertex(TVertex)

Sets the root vertex.

Declaration
public void SetRootVertex(TVertex root)
Parameters
Type Name Description
TVertex root

Root vertex.

Exceptions
Type Condition
System.ArgumentNullException

root is null.

| Improve this Doc View Source

TryGetRootVertex(out TVertex)

Tries to get the root vertex if set.

Declaration
public bool TryGetRootVertex(out TVertex root)
Parameters
Type Name Description
TVertex root

Root vertex if set, otherwise null.

Returns
Type Description
System.Boolean

True if the root vertex was set, false otherwise.

Events

| Improve this Doc View Source

RootVertexChanged

Fired when the root vertex is changed.

Declaration
public event EventHandler RootVertexChanged
Event Type
Type Description
System.EventHandler

Implements

IAlgorithm<TGraph>
IComputation
IAlgorithmComponent

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