More incomplete work

This commit is contained in:
pahimar 2013-05-30 07:43:53 -04:00
parent 3b521de823
commit 6d57b7c426
2 changed files with 22 additions and 4 deletions

View file

@ -85,6 +85,24 @@ public class WeightedDirectedGraph<T> implements Iterable<T> {
return Collections.unmodifiableSortedSet(graph.get(from)); return Collections.unmodifiableSortedSet(graph.get(from));
} }
public void removeEdge(T from, T to) {
removeEdge(from, to, 1);
}
public void removeEdge(T from, T to, int weight) {
if (!(graph.containsKey(from) && graph.containsKey(to))) {
throw new NoSuchElementException("Missing nodes from graph");
}
// TODO Finish this
}
public void removeAllEdges(T from, T to) {
// TODO Finish this
}
@Override @Override
public Iterator<T> iterator() { public Iterator<T> iterator() {

View file

@ -2,16 +2,16 @@ package com.pahimar.ee3.emc.graph;
public class WeightedEdge<T> { public class WeightedEdge<T> {
private int weight; private float weight;
private T target; private T target;
public WeightedEdge(int weight, T target) { public WeightedEdge(float weight, T target) {
this.weight = weight; this.weight = weight;
this.target = target; this.target = target;
} }
public int getWeight() { public float getWeight() {
return weight; return weight;
} }
@ -21,7 +21,7 @@ public class WeightedEdge<T> {
return target; return target;
} }
public void setWeight(int weight) { public void setWeight(float weight) {
this.weight = weight; this.weight = weight;
} }