| Algorithm 2 The improved Floyd-Warshall’s shortest path algorithm |
| Input: |
| The initial weights of the graph: |
| The number of vertices: |
| Output: |
| The final matrix of the shortest paths: |
| 1: for to do |
| 2: for to do |
| 3: ; |
| 4: end for |
| 5: end for |
| 6: for to do |
| 7: for to do |
| 8: |
| 9: for to do |
| 10: ; |
| 11: ; |
| 12: end for |
| 13: end for |
| 14: end for |
| 15: return ; |