Commit f3a8e616 authored by DaGal's avatar DaGal
Browse files

Fix for the case of points snapped to the same edge

parent a35562ea
...@@ -51,7 +51,17 @@ public class RealDijkstraOneToMany extends Dijkstra { ...@@ -51,7 +51,17 @@ public class RealDijkstraOneToMany extends Dijkstra {
currEdge = nodesMap.get(to); currEdge = nodesMap.get(to);
if (currEdge == null) { if (currEdge == null) {
return super.calcPath(from, to); currEdge = fromHeap.poll();
if (currEdge == null) {
currEdge = createSPTEntry(from, 0);
}
super.runAlgo();
if (currEdge != null) {
fromHeap.add(currEdge);
}
} }
return extractPath(); return extractPath();
...@@ -63,8 +73,8 @@ public class RealDijkstraOneToMany extends Dijkstra { ...@@ -63,8 +73,8 @@ public class RealDijkstraOneToMany extends Dijkstra {
} }
@Override @Override
protected boolean isMaxVisitedNodesExceeded() { protected boolean finished() {
nodesMap.put(currEdge.adjNode, currEdge); nodesMap.put(currEdge.adjNode, currEdge);
return super.isMaxVisitedNodesExceeded(); return super.finished();
} }
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment