麻省理工学院:《算法导论》(英文版) Lecture 18 Prof erik demaine

Introduction to algorithms 6.046J/18,401J/SMA5503 Lecture 18 Prof erik demaine
Introduction to Algorithms 6.046J/18.401J/SMA5503 Lecture 18 Prof. Erik Demaine

Negative-weight cycles Recall: If a graph G=(V, E) contains a negative weight cycle then some shortest paths may not exist Example: <0 Bellman-Ford algorithm: Finds all shortest-pat lengths from a sources e y to all ve yor determines that a negative-weight cycle exists c 2001 by Charles E Leiserson Introduction to Algorithms Day 31 L18.2
© 2001 by Charles E. Leiserson Introduction to Algorithms Day 31 L18.2 Negative-weight cycles Recall: If a graph G = (V, E) contains a negativeweight cycle, then some shortest paths may not exist. Example: uu vv … < 0 Bellman-Ford algorithm: Finds all shortest-path lengths from a source s ∈ V to all v ∈ V or determines that a negative-weight cycle exists

Bellman- Ford algorithm ds]du+ w(u, v) relaxation then dlv]←+w(al,y)∫step for each edge(l2y)∈E do if dv>du+w(u, v) then report that a negative-weight cycle exists At the end dv=8(s, v). Time=O(VE) c 2001 by Charles E Leiserson Introduction to Agorithms Day31L18.3
© 2001 by Charles E. Leiserson Introduction to Algorithms Day 31 L18.3 Bellman-Ford algorithm d[s] ← 0 for each v ∈ V – {s} do d[v] ← ∞ for i ← 1 to |V| – 1 do for each edge (u, v) ∈ E do if d[v] > d[u] + w(u, v) then d[v] ← d[u] + w(u, v) for each edge (u, v) ∈ E do if d[v] > d[u] + w(u, v) then report that a negative-weight cycle exists initialization At the end, d[v] = δ(s, v). Time = O(VE). relaxation step

Example of bellman-Ford AB C E B 0 E D c 2001 by Charles E Leiserson Introduction to Agorithms Day 31 L18.4
© 2001 by Charles E. Leiserson Introduction to Algorithms Day 31 L18.4 Example of Bellman-Ford AA BB EE CC DD –1 4 1 2 –3 2 5 3 ABCDE 0 ∞∞∞∞ ∞ 0 ∞ ∞ ∞

Example of Bellman-Ford AB C E B 2 000 E D c 2001 by Charles E Leiserson Introduction to Agorithms Day 31 L18.5
© 2001 by Charles E. Leiserson Introduction to Algorithms Day 31 L18.5 –1∞ 0 –1 ∞∞∞ Example of Bellman-Ford AA BB EE CC DD –1 4 1 2 –3 2 5 3 ABCDE 0 ∞∞∞∞ 0 ∞ ∞ ∞

Example of bellman-Ford AB C E B 000 E)0-14∞ D 4 c 2001 by Charles E Leiserson Introduction to Agorithms Day 31 L18.6
© 2001 by Charles E. Leiserson Introduction to Algorithms Day 31 L18.6 –1∞ 0 –1 ∞∞∞ Example of Bellman-Ford AA BB EE CC DD –1 4 1 2 –3 2 5 3 ABCDE 0 ∞∞∞∞ 0 ∞ 4 ∞ 0 –1 4 ∞∞

Example of bellman-Ford AB C E B 000 E)0-14∞ 0-12∞ D c 2001 by Charles E Leiserson Introduction to Agorithms Day 31 L18.7
© 2001 by Charles E. Leiserson Introduction to Algorithms Day 31 L18.7 4 0 –1 2 ∞ ∞ 2 –1∞ 0 –1 ∞∞∞ Example of Bellman-Ford AA BB EE CC DD –1 4 1 2 –3 2 5 3 ABCDE 0 ∞∞∞∞ 0 ∞ ∞ 0 –1 4 ∞∞

Example of bellman-Ford AB C E B 000 E)0-14∞ 0-12∞ D c 2001 by Charles E Leiserson Introduction to Agorithms Day 31 L18.8
© 2001 by Charles E. Leiserson Introduction to Algorithms Day 31 L18.8 –1∞ Example of Bellman-Ford AA BB EE CC DD –1 4 1 2 –3 2 5 3 0 ∞ 2 ∞ 0 –1 2 ∞ ∞ 0 –1 ∞∞∞ ABCDE 0 ∞∞∞∞ 0 –1 4 ∞∞

Example of bellman-Ford AB C E B人、2 000 E)0-14∞ 0-12∞ D 0-12∞1 c 2001 by Charles E Leiserson Introduction to Agorithms Day 31 L18.9
© 2001 by Charles E. Leiserson Introduction to Algorithms Day 31 L18.9 –1∞ Example of Bellman-Ford AA BB EE CC DD –1 4 1 2 –3 2 5 3 0 2 ∞ 0 –1 2 ∞ ∞ 0 –1 ∞∞∞ ABCDE 0 ∞∞∞∞ 0 –1 4 ∞∞ 1 0 –1 2 ∞ 1

Example of bellman-Ford AB C E B 000 E 14∞ 12∞ D 0000 12∞1 c 2001 by Charles E Leiserson Introduction to Agorithms Day 31 L18.10
© 2001 by Charles E. Leiserson Introduction to Algorithms Day 31 L18.10 ∞1 0 –1 2 1 1 –1∞ Example of Bellman-Ford AA BB EE CC DD –1 4 1 2 –3 2 5 3 0 2 0 –1 2 ∞ ∞ 0 –1 ∞∞∞ ABCDE 0 ∞∞∞∞ 0 –1 4 ∞∞ 1 0 –1 2 ∞ 1
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 麻省理工学院:《算法导论》(英文版)Lecture 17 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 16 Prof charles e. leiserson.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 15 Prof charles e. leiserson.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 14 Prof charles e. leiserson.pdf
- 麻省理工学院:《算法导论》(英文版)Lecture 13 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 12 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 11 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 10 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 9 Prof charles e. leiserson.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 8 Prof charles e. leiserson.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 7 Prof charles e. leiserson.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 6 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版)Lecture 5 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版)Lecture 4 Prof. charles e. leiserson.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 3 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 2 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture Prof. Charles E. Leiserson.pdf
- 桂林电子科技大学:《可编程ASIC原理》课程教学资源(实验指导书)实验二 波形输入与仿真实现.pdf
- 桂林电子科技大学:《可编程ASIC原理》课程教学资源(实验指导书)综合、设计性实验指导书.pdf
- 桂林电子科技大学:《可编程ASIC原理》课程教学资源(实验指导书)封面.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 19 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 20 Prof erik demaine.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 21 Prof charles e. leiserson.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 22 Prof charles e. leiserson.pdf
- 麻省理工学院:《算法导论》(英文版) Lecture 23 Prof charles e. leiserson.pdf
- 《计算机三级网络技术》第一章 计算机基础知识.doc
- 《计算机三级网络技术》第七章 电子商务和电子政务.doc
- 《计算机三级网络技术》第三章 局域网基础.doc
- 《计算机三级网络技术》第二章 网络基本概念.doc
- 《计算机三级网络技术》第五章 因特网基础.doc
- 《计算机三级网络技术》第八章 网络技术展望.doc
- 《计算机三级网络技术》第六章 网络安全技术.doc
- 《计算机三级网络技术》第四章 网络操作系统.doc
- 吉林师范大学:《VBA》课程电子教案(PPT教学课件)目录.ppt
- 吉林师范大学:《VBA》课程电子教案(PPT教学课件)第六章 竞赛评分模板.ppt
- 吉林师范大学:《VBA》课程电子教案(PPT教学课件)第二章 Word2002应用基础.ppt
- 吉林师范大学:《VBA》课程电子教案(PPT教学课件)第四章 VBA编程.ppt
- 吉林师范大学:《VBA》课程电子教案(PPT教学课件)第八章 成绩汇总表及数据导入模板.ppt
- 吉林师范大学:《VBA》课程电子教案(PPT教学课件)第三章 Exce2002.ppt
- 吉林师范大学:《VBA》课程电子教案(PPT教学课件)第九章 排课摸版.ppt