class Edge implements Comparable{ //Edges consists of a v0 Vertex, v1 Vertex and a weight public Vertex v0; public Vertex v1; public float weight; boolean connected; Edge(Vertex s, Vertex e) { v0 = s; v1 = e; weight = dist(s.x, s.y, e.x, e.y); connected = false; } public int compareTo(Object edge) //overrides compareTo so I can use Collections to sort the edges { Edge n = (Edge) edge; float w1 = weight; float w2 = n.getWeight(); return w1 == w2 ? 0 : (w1 > w2 ? 1 : -1); } public float getWeight() { return weight; } public String toString() { return v0.id + "-" + v1.id; } }