added new features

This commit is contained in:
Adrien Barbanson 2021-05-18 18:43:01 +02:00
parent 59cfea1f4b
commit dc987176d1
2 changed files with 17 additions and 0 deletions

View file

@ -58,6 +58,7 @@ public class DijkstraAlgorithm extends ShortestPathAlgorithm {
// We stop the algorithm when the cost of last marked point is equal to the shortest found path
// or if we searched all the graph
while(lastMarkedNodeCost < shortestCostToDestination && !minHeap.isEmpty()) {
//We get the shortest not marked label
Label minLabel = minHeap.deleteMin();

View file

@ -354,4 +354,20 @@ public class Path {
return totalTime;
}
/**
* Compares the path with other path object
* @param other
* @return
*/
public boolean isSamePath(Path other) {
for(int i = 0 ; i < arcs.size() ; i++) {
if(this.arcs.get(i).getOrigin().getId() != other.arcs.get(i).getOrigin().getId()) {
return false;
}
if(this.arcs.get(i).getDestination().getId() != other.arcs.get(i).getDestination().getId()) {
return false;
}
}
return true;
}
}