Draw a simple, undirected graph yourself, the vertices are connected with each other including 8 vertices and 14 edges. Find the shortest path from two arbitrary vertices:
a) The weight of each edge is 1.
b) Self-weighting for edges
a) 8 vertices and 14 edges
Shortest path is minimum distance by following minimum weights between the 2 vertices.
Let the two arbitrary vertices are A,F.
Path to AF:
So, the shortest path is A-E-F (because weight = 2, smallest).
b) Self-weighting for edges
Path to AF:
So, the shortest path is A-E-G-F (since weight = 4, smallest).
Comments
Leave a comment