Class HoffmanPavleyRankedShortestPathAlgorithm<TVertex, TEdge>
Hoffman and Pavley K-shortest path algorithm.
Inheritance
Inherited Members
Namespace: QuikGraph.Algorithms.RankedShortestPath
Assembly: QuikGraph.dll
Syntax
public sealed class HoffmanPavleyRankedShortestPathAlgorithm<TVertex, TEdge> : RankedShortestPathAlgorithmBase<TVertex, TEdge, IBidirectionalGraph<TVertex, TEdge>>, IAlgorithm<IBidirectionalGraph<TVertex, TEdge>>, IComputation, IAlgorithmComponent where TEdge : IEdge<TVertex>
Type Parameters
Name | Description |
---|---|
TVertex | Vertex type. |
TEdge | Edge type. |
Remarks
Reference: Hoffman, W. and Pavley, R. 1959. A Method for the Solution of the Nth Best Path Problem. J. ACM 6, 4 (Oct. 1959), 506-514. DOI= http://doi.acm.org/10.1145/320998.321004
Constructors
| Improve this Doc View SourceHoffmanPavleyRankedShortestPathAlgorithm(IAlgorithmComponent, IBidirectionalGraph<TVertex, TEdge>, Func<TEdge, Double>, IDistanceRelaxer)
Initializes a new instance of the HoffmanPavleyRankedShortestPathAlgorithm<TVertex, TEdge> class.
Declaration
public HoffmanPavleyRankedShortestPathAlgorithm(IAlgorithmComponent host, IBidirectionalGraph<TVertex, TEdge> visitedGraph, Func<TEdge, double> edgeWeights, IDistanceRelaxer distanceRelaxer)
Parameters
Type | Name | Description |
---|---|---|
IAlgorithmComponent | host | Host to use if set, otherwise use this reference. |
IBidirectionalGraph<TVertex, TEdge> | visitedGraph | Graph to visit. |
System.Func<TEdge, System.Double> | edgeWeights | Function that for a given edge provide its weight. |
IDistanceRelaxer | distanceRelaxer | Distance relaxer. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
HoffmanPavleyRankedShortestPathAlgorithm(IBidirectionalGraph<TVertex, TEdge>, Func<TEdge, Double>)
Initializes a new instance of the HoffmanPavleyRankedShortestPathAlgorithm<TVertex, TEdge> class.
Declaration
public HoffmanPavleyRankedShortestPathAlgorithm(IBidirectionalGraph<TVertex, TEdge> visitedGraph, Func<TEdge, double> edgeWeights)
Parameters
Type | Name | Description |
---|---|---|
IBidirectionalGraph<TVertex, TEdge> | visitedGraph | Graph to visit. |
System.Func<TEdge, System.Double> | edgeWeights | Function that for a given edge provide its weight. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
HoffmanPavleyRankedShortestPathAlgorithm(IBidirectionalGraph<TVertex, TEdge>, Func<TEdge, Double>, IDistanceRelaxer)
Initializes a new instance of the HoffmanPavleyRankedShortestPathAlgorithm<TVertex, TEdge> class.
Declaration
public HoffmanPavleyRankedShortestPathAlgorithm(IBidirectionalGraph<TVertex, TEdge> visitedGraph, Func<TEdge, double> edgeWeights, IDistanceRelaxer distanceRelaxer)
Parameters
Type | Name | Description |
---|---|---|
IBidirectionalGraph<TVertex, TEdge> | visitedGraph | Graph to visit. |
System.Func<TEdge, System.Double> | edgeWeights | Function that for a given edge provide its weight. |
IDistanceRelaxer | distanceRelaxer | Distance relaxer. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
Methods
| Improve this Doc View SourceCompute(TVertex, TVertex)
Runs the algorithm with the given root
vertex.
Declaration
public void Compute(TVertex root, TVertex target)
Parameters
Type | Name | Description |
---|---|---|
TVertex | root | Root vertex. |
TVertex | target | Target vertex. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentNullException |
|
System.ArgumentException |
|
System.ArgumentException |
|
System.InvalidOperationException | Something went wrong when running the algorithm. |
InternalCompute()
Algorithm compute step.
Declaration
protected override void InternalCompute()
Overrides
SetTargetVertex(TVertex)
Sets the target vertex.
Declaration
public void SetTargetVertex(TVertex target)
Parameters
Type | Name | Description |
---|---|---|
TVertex | target | Target vertex. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
TryGetTargetVertex(out TVertex)
Tries to get the target vertex if set.
Declaration
public bool TryGetTargetVertex(out TVertex target)
Parameters
Type | Name | Description |
---|---|---|
TVertex | target | Target vertex if set, otherwise null. |
Returns
Type | Description |
---|---|
System.Boolean | True if the target vertex was set, false otherwise. |