Show / Hide Table of Contents

Class AlgorithmBase<TGraph>

Base class for all graph algorithm.

Inheritance
System.Object
AlgorithmBase<TGraph>
MaximumCliqueAlgorithmBase<TVertex, TEdge>
CondensationGraphAlgorithm<TVertex, TEdge, TGraph>
EdgeMergeCondensationGraphAlgorithm<TVertex, TEdge>
ConnectedComponentsAlgorithm<TVertex, TEdge>
IncrementalConnectedComponentsAlgorithm<TVertex, TEdge>
StronglyConnectedComponentsAlgorithm<TVertex, TEdge>
WeaklyConnectedComponentsAlgorithm<TVertex, TEdge>
KernighanLinAlgorithm<TVertex, TEdge>
MaximumBipartiteMatchingAlgorithm<TVertex, TEdge>
GraphAugmentorAlgorithmBase<TVertex, TEdge, TGraph>
MaximumFlowAlgorithm<TVertex, TEdge>
KruskalMinimumSpanningTreeAlgorithm<TVertex, TEdge>
PrimMinimumSpanningTreeAlgorithm<TVertex, TEdge>
PageRankAlgorithm<TVertex, TEdge>
RootedAlgorithmBase<TVertex, TGraph>
FloydWarshallAllShortestPathAlgorithm<TVertex, TEdge>
SourceFirstBidirectionalTopologicalSortAlgorithm<TVertex, TEdge>
SourceFirstTopologicalSortAlgorithm<TVertex, TEdge>
TopologicalSortAlgorithm<TVertex, TEdge>
UndirectedFirstTopologicalSortAlgorithm<TVertex, TEdge>
UndirectedTopologicalSortAlgorithm<TVertex, TEdge>
TransitiveClosureAlgorithm<TVertex, TEdge>
TransitiveReductionAlgorithm<TVertex, TEdge>
VertexColoringAlgorithm<TVertex, TEdge>
MinimumVertexCoverApproximationAlgorithm<TVertex, TEdge>
DataSetGraphPopulatorAlgorithm
MsaglGraphPopulator<TVertex, TEdge>
DirectedGraphMLAlgorithm<TVertex, TEdge>
Implements
IAlgorithm<TGraph>
IComputation
IAlgorithmComponent
Inherited Members
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 AlgorithmBase<TGraph> : IAlgorithm<TGraph>, IComputation, IAlgorithmComponent
Type Parameters
Name Description
TGraph

Graph type.

Constructors

| Improve this Doc View Source

AlgorithmBase(TGraph)

Initializes a new instance of the AlgorithmBase<TGraph> class.

Declaration
protected AlgorithmBase(TGraph visitedGraph)
Parameters
Type Name Description
TGraph visitedGraph

Graph to visit.

Exceptions
Type Condition
System.ArgumentNullException

visitedGraph is null.

| Improve this Doc View Source

AlgorithmBase(IAlgorithmComponent, TGraph)

Initializes a new instance of the AlgorithmBase<TGraph> class (with optional host).

Declaration
protected AlgorithmBase(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.

Properties

| Improve this Doc View Source

Services

Algorithm common services.

Declaration
public IAlgorithmServices Services { get; }
Property Value
Type Description
IAlgorithmServices
| Improve this Doc View Source

State

Current computation state.

Declaration
public ComputationState State { get; }
Property Value
Type Description
ComputationState
| Improve this Doc View Source

SyncRoot

Synchronizer object.

Declaration
public object SyncRoot { get; }
Property Value
Type Description
System.Object
| Improve this Doc View Source

VisitedGraph

Gets the graph to visit with this algorithm.

Declaration
public TGraph VisitedGraph { get; }
Property Value
Type Description
TGraph

Methods

| Improve this Doc View Source

Abort()

Abort the computation.

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

Clean()

Called on algorithm cleanup step.

Declaration
protected virtual void Clean()
| Improve this Doc View Source

Compute()

Runs the computation.

Declaration
public void Compute()
Exceptions
Type Condition
System.InvalidOperationException

Something went wrong when running the algorithm.

| Improve this Doc View Source

GetService<T>()

Gets the service with given T.

Declaration
public T GetService<T>()
Returns
Type Description
T

Found service, otherwise null.

Type Parameters
Name Description
T

Service type.

Exceptions
Type Condition
System.InvalidOperationException

Requested service is not present on algorithm.

| Improve this Doc View Source

Initialize()

Called on algorithm initialization step.

Declaration
protected virtual void Initialize()
| Improve this Doc View Source

InternalCompute()

Algorithm compute step.

Declaration
protected abstract void InternalCompute()
| Improve this Doc View Source

OnAborted(EventArgs)

Called on algorithm abort.

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

EventArgs.Empty.

| Improve this Doc View Source

OnFinished(EventArgs)

Called on algorithm finished.

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

EventArgs.Empty.

| Improve this Doc View Source

OnStarted(EventArgs)

Called on algorithm start.

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

EventArgs.Empty.

| Improve this Doc View Source

OnStateChanged(EventArgs)

Called on algorithm state changed.

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

EventArgs.Empty.

| Improve this Doc View Source

ThrowIfCancellationRequested()

Throws if a cancellation of the algorithm was requested.

Declaration
protected void ThrowIfCancellationRequested()
Exceptions
Type Condition
System.OperationCanceledException

If the algorithm cancellation service indicates IsCancelling is true.

| Improve this Doc View Source

TryGetService(Type, out Object)

Tries to get the service with given serviceType.

Declaration
protected virtual bool TryGetService(Type serviceType, out object service)
Parameters
Type Name Description
System.Type serviceType

Service type.

System.Object service

Found service.

Returns
Type Description
System.Boolean

True if the service was found, false otherwise.

| Improve this Doc View Source

TryGetService<T>(out T)

Tries to get the service with given T.

Declaration
public bool TryGetService<T>(out T service)
Parameters
Type Name Description
T service

Found service.

Returns
Type Description
System.Boolean

True if the service was found, false otherwise.

Type Parameters
Name Description
T

Service type.

Events

| Improve this Doc View Source

Aborted

Fired when the computation is aborted.

Declaration
public event EventHandler Aborted
Event Type
Type Description
System.EventHandler
| Improve this Doc View Source

Finished

Fired when the computation is finished.

Declaration
public event EventHandler Finished
Event Type
Type Description
System.EventHandler
| Improve this Doc View Source

Started

Fired when the computation start.

Declaration
public event EventHandler Started
Event Type
Type Description
System.EventHandler
| Improve this Doc View Source

StateChanged

Fired when the computation state changed.

Declaration
public event EventHandler StateChanged
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