/** * Representation of an undirected graph edge */ public class Edge { // instance variables public Vertex vertex1, vertex2; // vertices at either end of this edge public double weight; // distance between vertices (weight) /** * Construct a new edge * @param v1 vertex at one end of this edge * @param v2 vertex at the other end of this edge * @param wt the distance or weight of this edge */ public Edge(Vertex v1, Vertex v2, double wt) { vertex1 = v1; vertex2 = v2; weight = wt; } /** * Return the other vertex associated with this edge * @param v one of the vertices on this edge * @return the other vertix on this edge * @throws IllegalArgumentException if v is not one of the * vertices on this edge */ public Vertex opposite(Vertex v) { throw new UnsupportedOperationException(); } }