Interface IShortestPathAlgorithm<TVertex, TEdge, TWeight>
- Namespace
- Graph1x.Algorithms
- Assembly
- Graph1x.dll
A single-pair shortest-path strategy. Implementations (Dijkstra, Bellman-Ford, A*) are interchangeable behind this interface; pick by the graph's weight profile (non-negative, negative edges, heuristic available).
public interface IShortestPathAlgorithm<TVertex, TEdge, TWeight> where TVertex : notnull where TEdge : IEdge<TVertex> where TWeight : INumber<TWeight>
Type Parameters
TVertexThe vertex type.
TEdgeThe edge type.
TWeightThe numeric weight type.
Methods
FindPath(IReadOnlyGraph<TVertex, TEdge>, TVertex, TVertex)
Finds the shortest path from source to target.
ShortestPathResult<TVertex, TWeight> FindPath(IReadOnlyGraph<TVertex, TEdge> graph, TVertex source, TVertex target)
Parameters
graphIReadOnlyGraph<TVertex, TEdge>The graph to search.
sourceTVertexThe start vertex.
targetTVertexThe end vertex.
Returns
- ShortestPathResult<TVertex, TWeight>
The query result, unreachable when no path exists.
Exceptions
- ArgumentException
Either endpoint is not in the graph.