Browse Source

added new features

Adrien Barbanson 2 years ago
parent
commit
dc987176d1

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

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

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

354
 		return totalTime;
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