public class Edge { public Vertex vertex1, vertex2; // undirected edge -- no significance public double weight; // the distance btwn the two vertices -- used // as the cost for shortest-path / MST problems public Edge(Vertex v1, Vertex v2, double wt) { vertex1 = v1; vertex2 = v2; weight = wt; } // returns the other vertex that's a member of the edge. If v is // not in the edge, throw an IllegalArgumentException. Vertex opposite(Vertex v) { throw new UnsupportedOperationException(); } }