Class DijkstraShortestPath<V,W>
java.lang.Object
org.episteme.core.mathematics.discrete.DijkstraShortestPath<V,W>
Dijkstra's algorithm for finding the shortest paths in a weighted graph.
Computes shortest paths from a single source vertex to all other vertices (or a specific target) in a graph with non-negative edge weights.
*
Reference:
Dijkstra, E. W. (1959). A note on two problems in connexion with graphs. Numerische Mathematik, 1, 269-271.
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Summary
ConstructorsConstructorDescriptionDijkstraShortestPath(WeightedGraph<V, W> graph, GraphWeightAdapter<W> adapter) Creates a new Dijkstra algorithm instance. -
Method Summary
Modifier and TypeMethodDescriptioncomputeAllDistances(V source) Computes shortest paths from source to all reachable vertices.Computes the shortest path from source to target.getDistance(V source, V target) Computes the length of the shortest path from source to target.static <V> DijkstraShortestPath<V, Double> ofDouble(WeightedGraph<V, Double> graph) Creates a new Dijkstra algorithm instance for Double weights.static <V> DijkstraShortestPath<V, Real> ofReal(WeightedGraph<V, Real> graph) Creates a new Dijkstra algorithm instance for Real weights.
-
Constructor Details
-
DijkstraShortestPath
Creates a new Dijkstra algorithm instance.- Parameters:
graph- the weighted graphadapter- the weight adapter for operations
-
-
Method Details
-
ofReal
Creates a new Dijkstra algorithm instance for Real weights.- Type Parameters:
V- the vertex type- Parameters:
graph- the weighted graph with Real weights- Returns:
- a new instance
-
ofDouble
Creates a new Dijkstra algorithm instance for Double weights.- Type Parameters:
V- the vertex type- Parameters:
graph- the weighted graph with Double weights- Returns:
- a new instance
-
findPath
-
getDistance
-
computeAllDistances
-