Show / Hide Table of Contents

Class YenShortestPathsAlgorithm<TVertex>

A single-source K-shortest loopless paths algorithm for graphs with non negative edge cost.

Inheritance
System.Object
YenShortestPathsAlgorithm<TVertex>
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.ShortestPath
Assembly: QuikGraph.dll
Syntax
public class YenShortestPathsAlgorithm<TVertex>
Type Parameters
Name Description
TVertex

Vertex type.

Constructors

| Improve this Doc View Source

YenShortestPathsAlgorithm(AdjacencyGraph<TVertex, EquatableTaggedEdge<TVertex, Double>>, TVertex, TVertex, Int32, Func<EquatableTaggedEdge<TVertex, Double>, Double>, Func<IEnumerable<YenShortestPathsAlgorithm<TVertex>.SortedPath>, IEnumerable<YenShortestPathsAlgorithm<TVertex>.SortedPath>>)

Initializes a new instance of the YenShortestPathsAlgorithm<TVertex> class.

Declaration
public YenShortestPathsAlgorithm(AdjacencyGraph<TVertex, EquatableTaggedEdge<TVertex, double>> graph, TVertex source, TVertex target, int k, Func<EquatableTaggedEdge<TVertex, double>, double> edgeWeights = null, Func<IEnumerable<YenShortestPathsAlgorithm<TVertex>.SortedPath>, IEnumerable<YenShortestPathsAlgorithm<TVertex>.SortedPath>> filter = null)
Parameters
Type Name Description
AdjacencyGraph<TVertex, EquatableTaggedEdge<TVertex, System.Double>> graph

Graph to visit.

TVertex source

Source vertex.

TVertex target

Target vertex.

System.Int32 k

Maximum number of path to search.

System.Func<EquatableTaggedEdge<TVertex, System.Double>, System.Double> edgeWeights

Optional function that computes the weight for a given edge.

System.Func<System.Collections.Generic.IEnumerable<YenShortestPathsAlgorithm.SortedPath<>>, System.Collections.Generic.IEnumerable<YenShortestPathsAlgorithm.SortedPath<>>> filter

Optional filter of found paths.

Remarks

System.Double for tag type (edge) which comes from Dijkstra’s algorithm, which is used to get one shortest path.

Exceptions
Type Condition
System.ArgumentNullException

graph is null.

System.ArgumentNullException

source is null.

System.ArgumentNullException

target is null.

System.ArgumentException

source is not part of graph.

System.ArgumentException

target is not part of graph.

System.ArgumentOutOfRangeException

k is lower than 1.

Methods

| Improve this Doc View Source

Execute()

Runs the algorithm.

Declaration
public IEnumerable<YenShortestPathsAlgorithm<TVertex>.SortedPath> Execute()
Returns
Type Description
System.Collections.Generic.IEnumerable<YenShortestPathsAlgorithm.SortedPath<>>

Found paths.

Exceptions
Type Condition
NoPathFoundException

No shortest path was found.

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