guys i have a set of vertex and edges created.
Vertex vertexA = new Vertex("A", "A");
Vertex vertexB = new Vertex("B", "B");
Vertex vertexC = new Vertex("C", "C");
Vertex vertexD = new Vertex("D", "D");
Vertex vertexE = new Vertex("E", "E");
Edge e1 = new Edge("e1", vertexA, vertexB, 10);
Edge e2 = new Edge("e2", vertexA, vertexC, 14);
Edge e3 = new Edge("e3", vertexA, vertexD, 7);
Edge e4 = new Edge("e4", vertexB, vertexC, 21);
Edge e5 = new Edge("e5", vertexB, vertexD, 12);
Edge e6 = new Edge("e6", vertexB, vertexE, 27);
Edge e7 = new Edge("e7", vertexC, vertexD, 8);
Edge e8 = new Edge("e8", vertexC, vertexE, 13);
Edge e9 = new Edge("e9", vertexD, vertexE, 15);
public class Vertex {
final private String id;
final private String name;
.....
public class Edge {
private final String id;
private final Vertex source;
private final Vertex destination;
private final int weight;
// doesn't matter coz is an undirected graph so whichever vertex can be source or destination
......