Introduction to main()
The sample main function creates the following graph with two connected components:
(0,10)
(10,10) (20,10)
(10,6)
(10,4) (20,4)
(30,10)
(5,6)
(5,4)
(25,5)
Figure 1: Graph g1
The shortest path between (0,0) and (10,6) is (0,0),(5,6),(10,6). There is no path between (0,0) and (25,5), in which case ShortsetPath() does not print anything.
After the edge (0,0)-(5,6) is removed, the shortest path between (0,0) and (10,6) is (0,0),(5,4),(10,4),(10,6).
(0,10)
(0,0)
(0,0)
(10,10) (20,10)
(10,6)
(10,4) (20,4)
(30,10)
(5,6)
(5,4)
(25,5)
Figure 2: Graph g1 after the edge (0,0)-(5,6) is removed
The output of ReachableVertices() for (0,0) is (0,10),(5,4),(5,6),(10,4),(10,6),(10,10). Notice that the output is dependent on your implementation. The output of ReachableVertices() for (20,4) is (20,10),(25,5),(30,10).
A sample output of ShowGraph(g1) is (0,0),(0,10) (0,0),(5,4) (0,10),(10,10) (0,10),(5,6) (5,4),(10,4) (10,10), (10,6) (5, 6),(10,6) (10,4), (10,6) (20,4), (20,10) (20,10), (30,10) (30,10),(25,5). Notice that the output is dependent on your implementation.