Loading in 5 sec....

The single-source shortest path problem PowerPoint Presentation

The single-source shortest path problem

- 163 Views
- Uploaded on

Download Presentation
## PowerPoint Slideshow about ' The single-source shortest path problem ' - prisca

**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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript

The Single-Source Shortest Path Problem

- The single-source shortest path problem是要用來尋找所有由同一個源點到達圖上每一個節點的最短路徑.
- 給予一個連接的有向圖形G=(V,E),且每條邊的權重皆不為負值. This weight can be considered as the length of this edge.
- 由於是要尋找最短路徑，等同於花費最少的成本到達每個節點，同為Greedy method.

The Single-Source Shortest Path Problem

- Shortest paths from v0 to all of the other vertices are found one by one. The nearest neighbor of v0 is first found. Then the second nearest neighbor of v0 is found. This processis repeated until the nth nearest neighbor of v0 is found where n is the number of vertices in the graph other than v0.

Vertices - S: V-S

Dijkstra’s Algorithm

Input:有向圖G= (V, E) 與源點v0. 取得與v0相連每 個點的邊上權重c. |V|= n + 1.

Output: 對於每個vÎ V, 所取得的權重最小值

S: = {v0}

Fori : = 1 to n do

Begin

If (v0, vi) ÎE then

L(vi) : = c(v0, vi)

else

L(vi) : = ¥

End

Dijkstra’s Algorithm

For i : = 1 to n do

Begin

Choose u from V - S such that L(u) is thesmallest

S : = S ∪{u} (* Put u into S *)

For all w in V - S do

L(w) : = min(L(w), L(u) + c(u, w))

End

Time Complexity

- Time =
Ω(V·取得連接邊的權重c

+E·比較最小權重邊並取代)

Binary Heap:

V·logV+E·logV → E· logV

Fibonacci Heap:

(E+ V· logV)

E

Download Presentation

Connecting to Server..