Support 2 types of graphs - directed and undirected with 3 operations:
addVertex - adds vertex to the graph
Vertex addVertex()
addEdge - adds edge to the graph
void addEdge(Vertex source,Vertex target)
getPath - returns a list of edges between 2 vertices (path doesn’t have to be optimal)
List<Edge> getPath(Vertex source, Vertex target)
Graph graph = new DirectedGraph();
Vertex v1 = graph.addVertex();
Vertex v2 = graph.addVertex();
Vertex v3 = graph.addVertex();
Vertex v4 = graph.addVertex();
Vertex v5 = graph.addVertex();
Vertex v6 = graph.addVertex();
graph.addEdge(v1, v2);
graph.addEdge(v1, v5);
graph.addEdge(v1, v6);
graph.addEdge(v2, v3);
graph.addEdge(v2, v5);
graph.addEdge(v3, v4);
graph.addEdge(v5, v4);
graph.getPath(v1,v4);