1 / 9

Floyd 演算法介紹

Floyd 演算法介紹. M0224005 劉奕顯. Floyd 演算法 (1/8). 完全最短路徑問題 (All-pairs shortest-paths problem) :找到每個節點到其他所有節點的最短距離 距離矩陣:記錄最短路徑的長度. Floyd 演算法 (2/8). 生成距離矩陣 代表從第 i 個節點到第 j 個節點的最短路徑的長度, 且路徑中經過的中間節點數量不大於 k 當 時. Floyd 演算法 (3/8). Floyd 演算法 (4/8). Floyd 演算法 (5/8).

Download Presentation

Floyd 演算法介紹

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Floyd演算法介紹 M0224005 劉奕顯

  2. Floyd演算法(1/8) • 完全最短路徑問題(All-pairs shortest-paths problem):找到每個節點到其他所有節點的最短距離 • 距離矩陣:記錄最短路徑的長度

  3. Floyd演算法(2/8) • 生成距離矩陣 • 代表從第i個節點到第j個節點的最短路徑的長度, 且路徑中經過的中間節點數量不大於k • 當 時

  4. Floyd演算法(3/8)

  5. Floyd演算法(4/8)

  6. Floyd演算法(5/8)

  7. Floyd演算法(6/8)

  8. Floyd演算法(7/8)

  9. Floyd演算法(8/8) Floyd(W [1..n, 1..n]) //輸入:圖形的加權矩陣W //輸出:最短路徑長度的距離矩陣D D← W for k ← 1 to n do for i ← 1 to n do for j ← 1 to n do D[i,j] ← min{ D[i,j] , D[i,k]+D[k,j] } return D

More Related