Presentation is loading. Please wait.

Presentation is loading. Please wait.

Shortest-Paths Trees Kun-Mao Chao (趙坤茂)

Similar presentations


Presentation on theme: "Shortest-Paths Trees Kun-Mao Chao (趙坤茂)"— Presentation transcript:

1 Shortest-Paths Trees Kun-Mao Chao (趙坤茂)
Department of Computer Science and Information Engineering National Taiwan University, Taiwan WWW:

2 Shortest-Paths Trees The objective is to find the set of edges connecting all nodes such that the sum of the edge lengths from the source to each node is minimized. In order to minimize the total path lengths, the path from the source to each node must be a shortest path connecting them.

3 Shortest-Paths Trees

4 Negative edges in an undirected graph

5 Directed graphs

6 Dijkstra's Algorithm

7 Choose a

8 Relax (a, b) and (a, g)

9 Choose b; Add (a, b) to T

10 Relax (b, c) and (b, d)

11 Choose g; Add (a, g) to T

12 Relax (g, e) and (g, h)

13 Choose d; Add (b, d) to T

14 Relax (d, e)

15 Choose h; Add (g, h) to T

16 Choose e; Add (d, e) to T

17 Relax (e, f)

18 Choose c; Add (b, c) to T

19 Relax (c, h)

20 Choose f; Add (e, f) to T

21 Relax (f, d) and (f, h)

22 The resulting SPT

23 Negative edge

24 Choose a

25 Choose b; Add (a, b) to T

26 Choose d; Add (b, d) to T

27 Choose c; Add (b, c) to T

28 Choose e; Add (d, e) to T

29 Something went wrong

30 A wrong SPT

31 A correct SPT

32 The Bellman-Ford Algorithm

33 δ[b] and δ[g] modified

34 δ[c], δ[d], δ[e] and δ[h] modified

35 δ[f] modified

36 δ[h] modified

37 A correct SPT

38 Try this in class


Download ppt "Shortest-Paths Trees Kun-Mao Chao (趙坤茂)"

Similar presentations


Ads by Google