Lecture 11.4
Lecture 11.4
Madhavan Mukund
https://www.cmi.ac.in/~madhavan
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 2/6
Shortest paths
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 2/6
Shortest paths
70
Recall that BFS explores a graph level 2 3
by level 80 6
50
BFS computes shortest path, in terms 0 1 4 5
10 20
of number of edges, to every reachable 5 10
vertex 6
May assign values to edges
Cost, time, distance, . . .
Weighted graph
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 2/6
Shortest paths
70
Recall that BFS explores a graph level 2 3
by level 80 6
50
BFS computes shortest path, in terms 0 1 4 5
10 20
of number of edges, to every reachable 5 10
vertex 6
May assign values to edges
Cost, time, distance, . . .
Weighted graph
G = (V , E ), W : E → R
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 2/6
Shortest paths
70
Recall that BFS explores a graph level 2 3
by level 80 6
50
BFS computes shortest path, in terms 0 1 4 5
10 20
of number of edges, to every reachable 5 10
vertex 6
May assign values to edges
Cost, time, distance, . . .
Weighted graph
G = (V , E ), W : E → R
Adjacency matrix: record the weight
wherever there is an edge, 0 if no edge
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 2/6
Shortest paths
70
Recall that BFS explores a graph level 2 3
by level 80 6
50
BFS computes shortest path, in terms 0 1 4 5
10 20
of number of edges, to every reachable 5 10
vertex 6
May assign values to edges
0 1 2 3 4 5 6
Cost, time, distance, . . . 0 0 10 80 0 0 0 0
Weighted graph 1 10 0 6 0 20 0 0
2 80 6 0 70 0 0 0
G = (V , E ), W : E → R 3 0 0 70 0 0 0 0
4 0 20 0 0 0 50 5
Adjacency matrix: record the weight 5 0 0 0 0 50 0 10
wherever there is an edge, 0 if no edge 6 0 0 0 0 5 10 0
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 2/6
Shortest paths in weighted graphs
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 3/6
Shortest paths in weighted graphs
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 3/6
Shortest paths in weighted graphs
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 3/6
Shortest path problems
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 4/6
Shortest path problems
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 4/6
Shortest path problems
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 4/6
Shortest path problems
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 4/6
Shortest path problems
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 4/6
Shortest path problems
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 4/6
Negative edge weights
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 5/6
Negative edge weights
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 5/6
Negative edge weights
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 5/6
Negative edge weights
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 5/6
Negative edge weights
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 5/6
Negative edge weights
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 5/6
Negative edge weights
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 5/6
Negative edge weights
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 5/6
Negative edge weights
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 6/6
Summary
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 6/6
Summary
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 6/6
Summary
Madhavan Mukund Shortest Paths in Weighted Graphs Mathematics for Data Science 1, Week 12 6/6