1 Consider the network G1 ViE in figure 1 For a ije Vi find
1. Consider the network G1 (Vi,E) in figure 1. For a i,je Vi, find the length of a shortest path from node i to node j using the following methods.
Solution
Initial Matrix will be set as
Algorithm
1) If there doesn\'t exsists a vertex k in shortest path, then we keep the distance between the two vertices i an j as it is distance[i][j]
2) If the vertex k exists in shortest, then distance[i][j] =distance[i][k] + distance[k][j]
The final answer matrix will be
| 0 | 1 | Infinity | Infinity |
| Infinity | 0 | 1 | infinity |
| 1 | infinity | 0 | 1 |
| 1 | 1 | infinity | 0 |
