Class FloydWarshallAllShortestPathAlgorithm<TVertex, TEdge>
Floyd-Warshall all shortest path algorithm.
Inheritance
Inherited Members
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 SourceFloydWarshallAllShortestPathAlgorithm(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 |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
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 |
|
System.ArgumentNullException |
|
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 |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
Methods
| Improve this Doc View SourceDump(TextWriter)
Dumps current data state to stream writer
.
Declaration
[Conditional("DEBUG")]
public void Dump(TextWriter writer)
Parameters
Type | Name | Description |
---|---|---|
System.IO.TextWriter | writer |
Initialize()
Called on algorithm initialization step.
Declaration
protected override void Initialize()
Overrides
InternalCompute()
Algorithm compute step.
Declaration
protected override void InternalCompute()
Overrides
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 |
|
System.ArgumentNullException |
|
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 |
|
System.ArgumentNullException |
|
System.InvalidOperationException | Failed to find a predecessor vertex while getting path. |