Implement an Edge by Linked List


1.Edge.java
class Edge  {
	String vertex1, vertex2;

	//An Edge will have 2 vertex
	Edge (String n1, String n2) { 
		vertex1 = n1; vertex2 = n2; 
	}

	public String toString () {
		return vertex1 + " <-> " + vertex2;
	}
}

Add Comment