feat(dijkstra): implement Comparable in Label class

This commit is contained in:
Paul Alnet 2024-04-05 11:47:05 +02:00
parent 19ec6b6220
commit 7e0955ecb2

View file

@ -2,7 +2,7 @@ package org.insa.graphs.algorithm.shortestpath;
import org.insa.graphs.model.Node;
public class Label {
public class Label implements Comparable<Label> {
Node node;
boolean marked;
float pathCost;
@ -28,4 +28,9 @@ public class Label {
// function will be modified later
return pathCost;
}
public int compareTo(Label other) {
// TODO ensure this works properly
return (int)(this.pathCost - other.pathCost);
}
}