Browse Source

added new features

Adrien Barbanson 6 months ago
parent
commit
dc987176d1

+ 1
- 0
be-graphes-algos/src/main/java/org/insa/graphs/algorithm/shortestpath/DijkstraAlgorithm.java View File

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

+ 16
- 0
be-graphes-model/src/main/java/org/insa/graphs/model/Path.java View File

@@ -354,4 +354,20 @@ public class Path {
354 354
 		return totalTime;
355 355
 	}
356 356
 
357
+	/**
358
+	 * Compares the path with other path object
359
+	 * @param other
360
+	 * @return
361
+	 */
362
+	public boolean isSamePath(Path other) {
363
+		for(int i = 0 ; i < arcs.size() ; i++) {
364
+			if(this.arcs.get(i).getOrigin().getId() != other.arcs.get(i).getOrigin().getId()) {
365
+				return false;
366
+			}
367
+			if(this.arcs.get(i).getDestination().getId() != other.arcs.get(i).getDestination().getId()) {
368
+				return false;
369
+			}
370
+		}
371
+		return true;
372
+	}
357 373
 }

Loading…
Cancel
Save