Package org.graph4j.shortestpath
Class DijkstraShortestPathHeap
java.lang.Object
org.graph4j.GraphAlgorithm
org.graph4j.shortestpath.DijkstraShortestPathBase
org.graph4j.shortestpath.DijkstraShortestPathHeap
- All Implemented Interfaces:
SingleSourceShortestPath
Implementation of Dijkstra's algorithm that uses a heap in order to select
the optimal vertex at each step.
The complexity of this implementation is O(m log n), where m is the number of
edges and n the number of vertices.
Suitable for sparse graphs.
- Author:
- Cristian Frăsinaru
-
Field Summary
Fields inherited from class org.graph4j.shortestpath.DijkstraShortestPathBase
before, cost, numSolved, size, solved, source, verticesFields inherited from class org.graph4j.GraphAlgorithm
directed, graph -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intprotected voidpostUpdate(int index) protected voidMethods inherited from class org.graph4j.shortestpath.DijkstraShortestPathBase
compute, computePath, createPathEndingIn, findPath, getPathWeight, getPathWeights, getSourceMethods inherited from class org.graph4j.GraphAlgorithm
getGraphMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.graph4j.shortestpath.SingleSourceShortestPath
getGraph
-
Constructor Details
-
DijkstraShortestPathHeap
-
-
Method Details
-
preCompute
protected void preCompute()- Overrides:
preComputein classDijkstraShortestPathBase
-
postUpdate
protected void postUpdate(int index) - Overrides:
postUpdatein classDijkstraShortestPathBase
-
findMinIndex
protected int findMinIndex()- Specified by:
findMinIndexin classDijkstraShortestPathBase
-