the single source shortest path problem
Download
Skip this Video
Download Presentation
The single-source shortest path problem

Loading in 2 Seconds...

play fullscreen
1 / 9

The single-source shortest path problem - PowerPoint PPT Presentation


  • 163 Views
  • Uploaded on

The single-source shortest path problem. 許智凱. 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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
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 problem1
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.
slide3

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.
slide4

Source set: S

Vertices - S: V-S

dijkstra s algorithm
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 algorithm1
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

example
Example:

01234

30

0

0

2

01030

4

0102530

010253029

4

15

10

10

10

1

3

20

example1
Example:

ABCDE

0 10 3

2

B

D

0 7 3 11 5

10

0 7 3 9 5

A

4

8

9

3

C

E

2

time complexity
Time Complexity
  • Time =

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

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

Binary Heap:

V·logV+E·logV → E· logV

Fibonacci Heap:

(E+ V· logV)

E

ad