More incomplete work
This commit is contained in:
parent
3b521de823
commit
6d57b7c426
2 changed files with 22 additions and 4 deletions
|
@ -85,6 +85,24 @@ public class WeightedDirectedGraph<T> implements Iterable<T> {
|
|||
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
|
||||
public Iterator<T> iterator() {
|
||||
|
||||
|
|
|
@ -2,16 +2,16 @@ package com.pahimar.ee3.emc.graph;
|
|||
|
||||
public class WeightedEdge<T> {
|
||||
|
||||
private int weight;
|
||||
private float weight;
|
||||
private T target;
|
||||
|
||||
public WeightedEdge(int weight, T target) {
|
||||
public WeightedEdge(float weight, T target) {
|
||||
|
||||
this.weight = weight;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public int getWeight() {
|
||||
public float getWeight() {
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ public class WeightedEdge<T> {
|
|||
return target;
|
||||
}
|
||||
|
||||
public void setWeight(int weight) {
|
||||
public void setWeight(float weight) {
|
||||
|
||||
this.weight = weight;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue