Show / Hide Table of Contents

Class HoffmanPavleyRankedShortestPathAlgorithm<TVertex, TEdge>

Hoffman and Pavley K-shortest path algorithm.

Inheritance
System.Object
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>
RootedAlgorithmBase<TVertex, IBidirectionalGraph<TVertex, TEdge>>
RankedShortestPathAlgorithmBase<TVertex, TEdge, IBidirectionalGraph<TVertex, TEdge>>
HoffmanPavleyRankedShortestPathAlgorithm<TVertex, TEdge>
Implements
IAlgorithm<IBidirectionalGraph<TVertex, TEdge>>
IComputation
IAlgorithmComponent
Inherited Members
RankedShortestPathAlgorithmBase<TVertex, TEdge, IBidirectionalGraph<TVertex, TEdge>>.ShortestPathCount
RankedShortestPathAlgorithmBase<TVertex, TEdge, IBidirectionalGraph<TVertex, TEdge>>.ComputedShortestPathCount
RankedShortestPathAlgorithmBase<TVertex, TEdge, IBidirectionalGraph<TVertex, TEdge>>.ComputedShortestPaths
RankedShortestPathAlgorithmBase<TVertex, TEdge, IBidirectionalGraph<TVertex, TEdge>>.AddComputedShortestPath(IEnumerable<TEdge>)
RankedShortestPathAlgorithmBase<TVertex, TEdge, IBidirectionalGraph<TVertex, TEdge>>.DistanceRelaxer
RankedShortestPathAlgorithmBase<TVertex, TEdge, IBidirectionalGraph<TVertex, TEdge>>.Initialize()
RootedAlgorithmBase<TVertex, IBidirectionalGraph<TVertex, TEdge>>.TryGetRootVertex(TVertex)
RootedAlgorithmBase<TVertex, IBidirectionalGraph<TVertex, TEdge>>.SetRootVertex(TVertex)
RootedAlgorithmBase<TVertex, IBidirectionalGraph<TVertex, TEdge>>.ClearRootVertex()
RootedAlgorithmBase<TVertex, IBidirectionalGraph<TVertex, TEdge>>.RootVertexChanged
RootedAlgorithmBase<TVertex, IBidirectionalGraph<TVertex, TEdge>>.OnRootVertexChanged(EventArgs)
RootedAlgorithmBase<TVertex, IBidirectionalGraph<TVertex, TEdge>>.GetAndAssertRootInGraph()
RootedAlgorithmBase<TVertex, IBidirectionalGraph<TVertex, TEdge>>.AssertRootInGraph(TVertex)
RootedAlgorithmBase<TVertex, IBidirectionalGraph<TVertex, TEdge>>.Compute(TVertex)
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.SyncRoot
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.State
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.Compute()
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.Abort()
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.StateChanged
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.OnStateChanged(EventArgs)
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.Started
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.OnStarted(EventArgs)
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.Finished
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.OnFinished(EventArgs)
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.Aborted
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.OnAborted(EventArgs)
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.VisitedGraph
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.Services
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.GetService<T>()
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.TryGetService<T>(T)
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.TryGetService(Type, Object)
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.ThrowIfCancellationRequested()
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.Initialize()
AlgorithmBase<IBidirectionalGraph<TVertex, TEdge>>.InternalCompute()
AlgorithmBase<IBidirectionalGraph<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.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 Source

HoffmanPavleyRankedShortestPathAlgorithm(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

visitedGraph is null.

System.ArgumentNullException

edgeWeights is null.

System.ArgumentNullException

distanceRelaxer is null.

| Improve this Doc View Source

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

visitedGraph is null.

System.ArgumentNullException

edgeWeights is null.

| Improve this Doc View Source

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

visitedGraph is null.

System.ArgumentNullException

edgeWeights is null.

System.ArgumentNullException

distanceRelaxer is null.

Methods

| Improve this Doc View Source

Compute(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

root is null.

System.ArgumentNullException

target is null.

System.ArgumentException

root is not part of VisitedGraph.

System.ArgumentException

target is not part of VisitedGraph.

System.InvalidOperationException

Something went wrong when running the algorithm.

| Improve this Doc View Source

InternalCompute()

Algorithm compute step.

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

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

target is null.

| Improve this Doc View Source

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.

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