Consider the following weighted directed graph SolutionGiven
Consider the following weighted directed graph:
Solution
Given graph:
in single source shortest paths:we need to find shortest path from A to every other vertexes.
Now let find: A to B is:5 this is only shortest.
A to C is:10 this is only shortest. one more way is via E,D=2+6+7=15
A to D no direct way but via B=5+5=10; and via E=2+6=8 so this is shortest
A to E is:2 this is only shortest. and C,F is10+10+8=28.
A to F via E,D is:2+6+4=12 this is only shortest.then via c:10+10=20
so totally
| Node A to where | internal(via)vertex | total cost |
| A to B | - | 5 |
| A to C | - | 10 |
| A to D | E | 8 |
| A to E | - | 2 |
| A to F | E,D | 12 |
