Show / Hide Table of Contents

Class FloydWarshallAllShortestPathAlgorithm<TVertex, TEdge>

Floyd-Warshall all shortest path algorithm.

Inheritance
System.Object
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>
FloydWarshallAllShortestPathAlgorithm<TVertex, TEdge>
Implements
IAlgorithm<IVertexAndEdgeListGraph<TVertex, TEdge>>
IComputation
IAlgorithmComponent
Inherited Members
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.SyncRoot
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.State
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.Compute()
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.Abort()
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.StateChanged
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.OnStateChanged(EventArgs)
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.Started
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.OnStarted(EventArgs)
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.Finished
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.OnFinished(EventArgs)
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.Aborted
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.OnAborted(EventArgs)
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.VisitedGraph
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.Services
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.GetService<T>()
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.TryGetService<T>(T)
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.TryGetService(Type, Object)
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.ThrowIfCancellationRequested()
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.Initialize()
AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>.InternalCompute()
AlgorithmBase<IVertexAndEdgeListGraph<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.ShortestPath
Assembly: QuikGraph.dll
Syntax
public class FloydWarshallAllShortestPathAlgorithm<TVertex, TEdge> : AlgorithmBase<IVertexAndEdgeListGraph<TVertex, TEdge>>, IAlgorithm<IVertexAndEdgeListGraph<TVertex, TEdge>>, IComputation, IAlgorithmComponent where TEdge : IEdge<TVertex>
Type Parameters
Name Description
TVertex

Vertex type.

TEdge

Edge type.

Constructors

| Improve this Doc View Source

FloydWarshallAllShortestPathAlgorithm(IAlgorithmComponent, IVertexAndEdgeListGraph<TVertex, TEdge>, Func<TEdge, Double>, IDistanceRelaxer)

Initializes a new instance of the FloydWarshallAllShortestPathAlgorithm<TVertex, TEdge> class.

Declaration
public FloydWarshallAllShortestPathAlgorithm(IAlgorithmComponent host, IVertexAndEdgeListGraph<TVertex, TEdge> visitedGraph, Func<TEdge, double> edgeWeights, IDistanceRelaxer distanceRelaxer)
Parameters
Type Name Description
IAlgorithmComponent host

Host to use if set, otherwise use this reference.

IVertexAndEdgeListGraph<TVertex, TEdge> visitedGraph

Graph to visit.

System.Func<TEdge, System.Double> edgeWeights

Function that computes the weight for a given edge.

IDistanceRelaxer distanceRelaxer

Distance relaxer.

Exceptions
Type Condition
System.ArgumentNullException

visitedGraph is null.

System.ArgumentNullException

edgeWeights is null.

System.ArgumentNullException

distanceRelaxer is null.

| Improve this Doc View Source

FloydWarshallAllShortestPathAlgorithm(IVertexAndEdgeListGraph<TVertex, TEdge>, Func<TEdge, Double>)

Initializes a new instance of the FloydWarshallAllShortestPathAlgorithm<TVertex, TEdge> class.

Declaration
public FloydWarshallAllShortestPathAlgorithm(IVertexAndEdgeListGraph<TVertex, TEdge> visitedGraph, Func<TEdge, double> edgeWeights)
Parameters
Type Name Description
IVertexAndEdgeListGraph<TVertex, TEdge> visitedGraph

Graph to visit.

System.Func<TEdge, System.Double> edgeWeights

Function that computes the weight for a given edge.

Exceptions
Type Condition
System.ArgumentNullException

visitedGraph is null.

System.ArgumentNullException

edgeWeights is null.

| Improve this Doc View Source

FloydWarshallAllShortestPathAlgorithm(IVertexAndEdgeListGraph<TVertex, TEdge>, Func<TEdge, Double>, IDistanceRelaxer)

Initializes a new instance of the FloydWarshallAllShortestPathAlgorithm<TVertex, TEdge> class.

Declaration
public FloydWarshallAllShortestPathAlgorithm(IVertexAndEdgeListGraph<TVertex, TEdge> visitedGraph, Func<TEdge, double> edgeWeights, IDistanceRelaxer distanceRelaxer)
Parameters
Type Name Description
IVertexAndEdgeListGraph<TVertex, TEdge> visitedGraph

Graph to visit.

System.Func<TEdge, System.Double> edgeWeights

Function that computes the weight for a given edge.

IDistanceRelaxer distanceRelaxer

Distance relaxer.

Exceptions
Type Condition
System.ArgumentNullException

visitedGraph is null.

System.ArgumentNullException

edgeWeights is null.

System.ArgumentNullException

distanceRelaxer is null.

Methods

| Improve this Doc View Source

Dump(TextWriter)

Dumps current data state to stream writer.

Declaration
[Conditional("DEBUG")]
public void Dump(TextWriter writer)
Parameters
Type Name Description
System.IO.TextWriter writer
| Improve this Doc View Source

Initialize()

Called on algorithm initialization step.

Declaration
protected override void Initialize()
Overrides
QuikGraph.Algorithms.AlgorithmBase<QuikGraph.IVertexAndEdgeListGraph<TVertex, TEdge>>.Initialize()
| Improve this Doc View Source

InternalCompute()

Algorithm compute step.

Declaration
protected override void InternalCompute()
Overrides
QuikGraph.Algorithms.AlgorithmBase<QuikGraph.IVertexAndEdgeListGraph<TVertex, TEdge>>.InternalCompute()
| Improve this Doc View Source

TryGetDistance(TVertex, TVertex, out Double)

Tries to get the distance (distance) between source and target.

Declaration
public bool TryGetDistance(TVertex source, TVertex target, out double distance)
Parameters
Type Name Description
TVertex source

Source vertex.

TVertex target

Target vertex.

System.Double distance

Associated distance (cost).

Returns
Type Description
System.Boolean

True if the distance was found, false otherwise.

Exceptions
Type Condition
System.ArgumentNullException

source is null.

System.ArgumentNullException

target is null.

| Improve this Doc View Source

TryGetPath(TVertex, TVertex, out IEnumerable<TEdge>)

Tries to get the path that links both source and target vertices.

Declaration
public bool TryGetPath(TVertex source, TVertex target, out IEnumerable<TEdge> path)
Parameters
Type Name Description
TVertex source

Source vertex.

TVertex target

Target vertex.

System.Collections.Generic.IEnumerable<TEdge> path

The found path, otherwise null.

Returns
Type Description
System.Boolean

True if a path linking both vertices was found, false otherwise.

Exceptions
Type Condition
System.ArgumentNullException

source is null.

System.ArgumentNullException

target is null.

System.InvalidOperationException

Failed to find a predecessor vertex while getting path.

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