single source shortest path

Post on 12-Apr-2017

116 Views

Category:

Education

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Single-Source Shortest Path Single-Source Shortest Path Problem Problem Prepare byPrepare byDweep SarkerDweep Sarker

Mohibulla NomanMohibulla NomanStamford University BangladeshStamford University Bangladesh

Outline• Approach Dijksra’s Algorithm• Use Application• Improvement• Advantages• Disadvantages• In Future

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

Complexity

Weights Time complexity Authorℝ+ O(E + V log V) Dijkstra 1959

ℕ O(E)Thorup (requires constant-time multiplication).

Point-to-point Shortest Path Problem

o

Z

R

Vs

D

C

B

A

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.

1. Google maps2. Road routing

Example Application

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.

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.

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.

Run time:For a dance graph it is:

O{E+(V*V)}

For a sparse graph it is:O(E+ VlogV)

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.

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.

Thank you honorable Teacher Nazia Hossain(Briti)

Prepared by :Dweep sarkerMohibulla Noman CSE 052 06625CSE 052 06646

top related