single source shortest path
TRANSCRIPT
![Page 1: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/1.jpg)
Single-Source Shortest Path Single-Source Shortest Path Problem Problem Prepare byPrepare byDweep SarkerDweep Sarker
Mohibulla NomanMohibulla NomanStamford University BangladeshStamford University Bangladesh
![Page 2: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/2.jpg)
Outline• Approach Dijksra’s Algorithm• Use Application• Improvement• Advantages• Disadvantages• In Future
![Page 3: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/3.jpg)
Algorithms Solving the Problem
• Dijkstra’s algorithm – Solves only the problems with
nonnegative costs.• Floyd-Warshall and Bellman-Ford
algorithm solve the problems on graphs that do not have a cycle with negative cost
![Page 4: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/4.jpg)
Complexity
Weights Time complexity Authorℝ+ O(E + V log V) Dijkstra 1959
ℕ O(E)Thorup (requires constant-time multiplication).
![Page 5: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/5.jpg)
Point-to-point Shortest Path Problem
o
Z
R
Vs
D
C
B
A
![Page 6: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/6.jpg)
Dijkstra’s Idea
s x y
tentative d[y]
length(x,y)settled d[x]
priority queue
Qsettled
nearest unsettled neighbor of x
1. Shortest distance from s to all nodes initially “unsettled”.2. Shortest distance to s is zero. Tentative distance to others is ∞.3. Put all nodes in queue ordered by tentative distance from s.4. Take out nearest unsettled node, x. Settle its distance from s.5. For each unsettled immediate neighbor y of x6. If going from s to y through x is shorter than shortest path through
settled nodes, update tentative distance to y.7. Repeat from step 4, until distance to destination is settled.
![Page 7: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/7.jpg)
1. Google maps2. Road routing
Example Application
![Page 8: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/8.jpg)
Improve
• Heap sort requires only space of one record, quick sort O(logn) and merge sort requires O(n) node J&T(v) represent the label of node 0 to end D.
• The cost from node 0 to D is the sum of cost WOA and cost w.
• Reuse Dijkstra algorithm to get the optional path SPAD from A to D node.
![Page 9: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/9.jpg)
Advantage & Disadvantage
Advantage:Finds shortest path in O( E+ V Log(V) ) if you use a min priority queue. This is true only if you implement priority queue with Fibonacci heap, then amortized operation over it will take O(1). Otherwise, if you use any other implementation of priority_queue (like standard C++ STL) it should take E log(E) + V.
![Page 10: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/10.jpg)
Advantage & Disadvantage
Disadvantage:
Fails in cases where you have a negative edge
It has a blind searching method for this it take a huge amount of time.
![Page 11: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/11.jpg)
Run time:For a dance graph it is:
O{E+(V*V)}
For a sparse graph it is:O(E+ VlogV)
![Page 12: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/12.jpg)
In Future
Using in mapping.Using in city distance measurement. Traffic criteria management.Will use in networking Station distance.Will use in space distance
measurement.
![Page 13: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/13.jpg)
Conclusion
• The compute time complexity for each of the Dijkstra’s algorithm are acceptable in items of their overall performance in solving the shortest path problem. All of algorithm produce only one solution.
![Page 14: Single source shortest path](https://reader036.vdocuments.us/reader036/viewer/2022070522/58ede97a1a28ab422a8b459f/html5/thumbnails/14.jpg)
Thank you honorable Teacher Nazia Hossain(Briti)
Prepared by :Dweep sarkerMohibulla Noman CSE 052 06625CSE 052 06646