SlideShare uma empresa Scribd logo
1 de 25
25.All-Pairs Shortest Paths ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],25.All-Pairs Shortest Paths
[object Object],[object Object],[object Object],25.All-Pairs Shortest Paths
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],25.All-Pairs Shortest Paths
[object Object],[object Object],[object Object],[object Object],[object Object],25.1 Shortest paths and matrix multiplication
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],25.1 Shortest paths and matrix multiplication 需要花 Θ (n 3 ) 的時間
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],25.1 Shortest paths and matrix multiplication
25.1 Shortest paths and matrix multiplication 3 4 8 1 -5 7 2 6 -4
[object Object],[object Object],25.1 Shortest paths and matrix multiplication
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],25.1 Shortest paths and matrix multiplication
[object Object],[object Object],[object Object],Exercise 25.1
[object Object],[object Object],[object Object],[object Object],[object Object],25.2 The Floyd-Warshall algorithm
[object Object],[object Object],25.2 The Floyd-Warshall algorithm p 1 p 2
[object Object],[object Object],[object Object],[object Object],[object Object],25.2 The Floyd-Warshall algorithm
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],25.2 The Floyd-Warshall algorithm
25.2 The Floyd-Warshall algorithm 3 4 8 1 -5 7 2 6 -4 π ij (0)  = NIL if i = j or w ij  =  ∞ π ij (0)  = i if i ≠ j and  w ij  < ∞ π ij (k)  = π ij (k-1)  if d ij (k-1)  ≤ d ik (k-1)  + d kj (k-1) π ij (k)  = π kj (k-1)  if d ij (k-1)  > d ik (k-1)  + d kj (k-1)
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],25.2 The Floyd-Warshall algorithm
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],25.2 The Floyd-Warshall algorithm
[object Object],[object Object],[object Object],Exercise 25.2
[object Object],[object Object],[object Object],[object Object],[object Object],25.3 Johnson's algorithm for sparse graphs
[object Object],[object Object],25.3 Johnson's algorithm for sparse graphs
[object Object],[object Object],25.3 Johnson's algorithm for sparse graphs 3 4 8 1 -5 7 2 6 -4 1 2 3 4 5 0 0 0 0 0 0 -4 0 -1 -5 0
[object Object],25.3 Johnson's algorithm for sparse graphs 3 4 8 1 -5 7 2 6 -4 0 0 0 0 0 1 2 3 4 5 -4 0 -1 -5 0 4 0 13 0 0 10 2 2 0 0 5 1 0 4 0 1 2 3 4 5 -4 0 -1 -5 0
[object Object],25.3 Johnson's algorithm for sparse graphs 4 0 13 0 0 10 2 2 0 1 2 3 4 5 4 0 13 0 0 10 2 2 0 0 5 1 0 4 0 1 2 3 4 5 -4 0 -1 -5 0 0/0 2/1 2/-3 2/2 0/-4 2/3 0/0 0/-4 2/6 2/-1 2/7 0/4 0/0 0/5 2/3 2/2 0/-1 0/-5 0/0 2/-2 4/8 2/5 2/1 2/6 0/0
25.3 Johnson's algorithm for sparse graphs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

Mais conteúdo relacionado

Mais procurados

Minimum Spanning Tree
Minimum Spanning TreeMinimum Spanning Tree
Minimum Spanning Tree
zhaokatherine
 

Mais procurados (12)

Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
 
Matlab project
Matlab projectMatlab project
Matlab project
 
Maximum flow
Maximum flowMaximum flow
Maximum flow
 
minimum spanning trees Algorithm
minimum spanning trees Algorithm minimum spanning trees Algorithm
minimum spanning trees Algorithm
 
Minimum spanning tree
Minimum spanning treeMinimum spanning tree
Minimum spanning tree
 
Traveling salesman problem
Traveling salesman problemTraveling salesman problem
Traveling salesman problem
 
Minimum cost maximum flow
Minimum cost maximum flowMinimum cost maximum flow
Minimum cost maximum flow
 
Minimum Spanning Tree
Minimum Spanning TreeMinimum Spanning Tree
Minimum Spanning Tree
 
Minimum spanning Tree
Minimum spanning TreeMinimum spanning Tree
Minimum spanning Tree
 
Prim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning treePrim's Algorithm on minimum spanning tree
Prim's Algorithm on minimum spanning tree
 
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
ADA - Minimum Spanning Tree Prim Kruskal and Dijkstra
 
Binomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci HeapsBinomial Heaps and Fibonacci Heaps
Binomial Heaps and Fibonacci Heaps
 

Destaque

Lec1 Algorthm
Lec1 AlgorthmLec1 Algorthm
Lec1 Algorthm
humanist3
 
Santosh Sahu_MTech_CSE
Santosh Sahu_MTech_CSESantosh Sahu_MTech_CSE
Santosh Sahu_MTech_CSE
Santosh Sahu
 
lecture 21
lecture 21lecture 21
lecture 21
sajinsc
 
Lec2 Algorth
Lec2 AlgorthLec2 Algorth
Lec2 Algorth
humanist3
 
Fundamentals of data structures ellis horowitz & sartaj sahni
Fundamentals of data structures   ellis horowitz & sartaj sahniFundamentals of data structures   ellis horowitz & sartaj sahni
Fundamentals of data structures ellis horowitz & sartaj sahni
Hitesh Wagle
 
Selection sort
Selection sortSelection sort
Selection sort
Jay Patel
 

Destaque (20)

Lec32
Lec32Lec32
Lec32
 
Lec1 Algorthm
Lec1 AlgorthmLec1 Algorthm
Lec1 Algorthm
 
Santosh Sahu_MTech_CSE
Santosh Sahu_MTech_CSESantosh Sahu_MTech_CSE
Santosh Sahu_MTech_CSE
 
Mk ppt chapter 5
Mk ppt chapter 5Mk ppt chapter 5
Mk ppt chapter 5
 
chapter24.ppt
chapter24.pptchapter24.ppt
chapter24.ppt
 
lecture 21
lecture 21lecture 21
lecture 21
 
Introduction to the Internet of Things
Introduction to the Internet of ThingsIntroduction to the Internet of Things
Introduction to the Internet of Things
 
Lecture2
Lecture2Lecture2
Lecture2
 
Greedy algo revision 2
Greedy algo revision 2Greedy algo revision 2
Greedy algo revision 2
 
Lec2 Algorth
Lec2 AlgorthLec2 Algorth
Lec2 Algorth
 
Advance Network Technologies
Advance Network TechnologiesAdvance Network Technologies
Advance Network Technologies
 
Big data lecture notes
Big data lecture notesBig data lecture notes
Big data lecture notes
 
Fundamentals of data structures ellis horowitz & sartaj sahni
Fundamentals of data structures   ellis horowitz & sartaj sahniFundamentals of data structures   ellis horowitz & sartaj sahni
Fundamentals of data structures ellis horowitz & sartaj sahni
 
Computer Networks Lecture Notes
Computer Networks Lecture NotesComputer Networks Lecture Notes
Computer Networks Lecture Notes
 
The selection sort algorithm
The selection sort algorithmThe selection sort algorithm
The selection sort algorithm
 
6lowpan
6lowpan6lowpan
6lowpan
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Binary search
Binary searchBinary search
Binary search
 
Binary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of AlgorithmsBinary Search - Design & Analysis of Algorithms
Binary Search - Design & Analysis of Algorithms
 
Selection sort
Selection sortSelection sort
Selection sort
 

Semelhante a Chapter25 (6)

Acm图论
Acm图论Acm图论
Acm图论
 
Part 6 2010
Part 6 2010Part 6 2010
Part 6 2010
 
Sect14 1
Sect14 1Sect14 1
Sect14 1
 
福建省福州大学2019年暑假物理竞赛夏令营-物理奥赛进阶之路:0-1+微积分初步+40张ppt.pptx
福建省福州大学2019年暑假物理竞赛夏令营-物理奥赛进阶之路:0-1+微积分初步+40张ppt.pptx福建省福州大学2019年暑假物理竞赛夏令营-物理奥赛进阶之路:0-1+微积分初步+40张ppt.pptx
福建省福州大学2019年暑假物理竞赛夏令营-物理奥赛进阶之路:0-1+微积分初步+40张ppt.pptx
 
Chapter01
Chapter01Chapter01
Chapter01
 
对偶分解与拉格朗日松弛在自然语言处理推理的应用导论
对偶分解与拉格朗日松弛在自然语言处理推理的应用导论对偶分解与拉格朗日松弛在自然语言处理推理的应用导论
对偶分解与拉格朗日松弛在自然语言处理推理的应用导论
 

Chapter25

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8. 25.1 Shortest paths and matrix multiplication 3 4 8 1 -5 7 2 6 -4
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16. 25.2 The Floyd-Warshall algorithm 3 4 8 1 -5 7 2 6 -4 π ij (0) = NIL if i = j or w ij = ∞ π ij (0) = i if i ≠ j and w ij < ∞ π ij (k) = π ij (k-1) if d ij (k-1) ≤ d ik (k-1) + d kj (k-1) π ij (k) = π kj (k-1) if d ij (k-1) > d ik (k-1) + d kj (k-1)
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.