And missed that we changed the weight of an edge to float from int

This commit is contained in:
pahimar 2013-05-30 15:43:58 -04:00
parent 603a88bb1c
commit 7877ef2781

View file

@ -41,7 +41,7 @@ public class WeightedDirectedGraph<T> implements Iterable<T> {
addEdge(from, to, 1); addEdge(from, to, 1);
} }
public void addEdge(T from, T to, int weight) { public void addEdge(T from, T to, float weight) {
if (!(graph.containsKey(from) && graph.containsKey(to))) { if (!(graph.containsKey(from) && graph.containsKey(to))) {
throw new NoSuchElementException("Missing nodes from graph"); throw new NoSuchElementException("Missing nodes from graph");
@ -70,7 +70,7 @@ public class WeightedDirectedGraph<T> implements Iterable<T> {
return false; return false;
} }
public boolean edgeExists(T from, T to, int weight) { public boolean edgeExists(T from, T to, float weight) {
if (!(graph.containsKey(from) && graph.containsKey(to))) { if (!(graph.containsKey(from) && graph.containsKey(to))) {
throw new NoSuchElementException("Missing nodes from graph"); throw new NoSuchElementException("Missing nodes from graph");