# Multi-Source Shortest Paths - PowerPoint PPT Presentation

PPT – Multi-Source Shortest Paths PowerPoint presentation | free to view - id: 685272-MWY3Z

The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
Title:

## Multi-Source Shortest Paths

Description:

### Multi-Source Shortest Paths T. Patrick Bailey CSC 5408 Graph Theory 4/28/2008 – PowerPoint PPT presentation

Number of Views:24
Avg rating:3.0/5.0
Slides: 33
Provided by: TPatric
Category:
Tags:
Transcript and Presenter's Notes

Title: Multi-Source Shortest Paths

1
Multi-Source Shortest Paths
• T. Patrick Bailey
• CSC 5408 Graph Theory 4/28/2008

2
Inspiration
• Using the public transit system in the Denver
metro area (RTD) I discovered a problem.
• The web based tools put in place to assist
patrons in finding the shortest path to their
destination is limited.
• In its current implementation it only can search
for a shortest path given a single start time or
a single end time.

3
Inspiration (cont)
• I and many other professional workers are not
bound by a tight work schedule, our work hours
can float.
• Given this situation a more ideal search would
be to find the shortest path over a given time
(from 700AM to 900 AM) rather then from a
fixed time.
• This search would give us the shortest trip time
to our destination.

4
The Graph
• To help understand what a shortest path is in a
mass Transit Graph we need to understand what a
node in such a graph represents and how the
entire graph is formed.

5
• First we need to convert routes into individual
paths.
• Here is an example of a route where each node
representing a location (a bus stop)

B
D
E
C
A
Here we can see a bus route that goes from
location A to B, C, D, and finally E. But this
graph represents a route path. What we need is a
graph representing each unique bus path over
time.
6
B
D
E
C
A
This Route Path needs to be converted into
individual bus paths.
7
We turn the entire transit system into individual
bus paths. The nodes in this graph represent a
time and location
8
Then connect them up (Details Beyond the scope
of this talk)
9
Weights are assigned to each edge (The time
difference between nodes)
10
We now have a graphical representation of the
transit system with weights. The Transit
Graph Now what do we do with it?
11
As a commuter we want to find the shortest path
(time) over some range of time.
First we Find Nodes on the Transit Graph which
are near our start location Ex. within 1 mile
from 700 AM 900 AM These are our Source Nodes
To Do This
12
Next we Find Nodes on the Transit Graph which are
near our destinationWithin 1 mile from 700 AM
1100 AM
13
So here is the problem. How do we find the
shortest path from multiple Source Nodes to
multiple Destination Nodes
Destination Nodes
Source Nodes
14
Several Types of Solutions
• Single Source Shortest Path (SSSP) - This
type of solution can only find the shortest path
from a single source. We can use it though, by
simply running it once per source and comparing
the results to each other and choosing the best
result.
• All Pairs Shortest Paths (APSP) - This type of
solution gives us more then what we need. As it
gives the shortest path between all pairs of
vertices in a graph.

15
Djikstras Algorithm D59 A SSSP solution
• Type - Single Source Shortest Path
• Runtime - O(V2) (converted to a MSSP O(V3))
• Input - A weighted connected graph G whose
edge weights are non-negative.
• Output - A spanning Tree of G whose root is
your source node S. Any path on this tree
from S to any other node is a shortest path to
that node.

16
Djikstras Algorithm Example
• Here is our weighted Graph with no negative
weight edges

First we find all frontier edges
Then we again find all frontier edges
We keep repeating this process until we have a
Spanning Tree
Then we select the edge with the smallest overall
weight and add that edge and vertice to our
spanning Tree
S
17
Djikstra spanning Tree
S
18
An IdeaConverting our MSSP to a SSSP
• In my bus problem all edge weights are gt 0.
• Therefore we can easily convert the Multi-Source
Shortest Path to a Single-Source Shortest Path
by linking the all source nodes to a single
source node with 0 weight edges. And we can do
the same for the destination node.

19
Turning it into a Single Source Problem (And
saving us O(V) in runtime )
Destination Nodes
Source Nodes
20
• Its faster
• It gets the fastest path without need for
comparing the sets of fastest paths between node
• Once we find a path to our destination we can
stop since we know its a fastest path.
• We lose information, perhaps we want to know the
fastest 10 paths. We lose that information.

21
All Pairs Shortest Paths (APSP)
• There are many algorithms for solving the APSP.
Due to time constraint I will only show Min-Plus
Product and if time allows the Technique of
Repeated Squaring.

22
Min-Plus Product
• Type - All Pairs Shortest Path
• Runtime -
• Input - A weighted connected graph G which
contains now negative weight cycles.
• Output - A Matrix Showing Weight of shortest
path (we can store a path along the way)

23
Min-Plus Product
First create a matrix representing the weights
between edges. This graph represents Where m
represents the longest path
24
Min-Plus Product
• What we need is
• Since the shortest path between any two vertices
on graph is n-1
• This runs in
• Since this equation needs (m-1) the prior
matrix. We need each matrix along the way we
need 1,2,3 n-1
• For an overall runtime of

25
(No Transcript)
26
Technique of Repeated Squaring.
• Type - All Pairs Shortest Path
• Runtime -
• Input - A weighted connected graph G which
contains now negative weight cycles.
• Output - A Matrix Showing Weight of shortest
path (we can store a path along the way)

27
Technique of Repeated Squaring.
• The Min-Plus Product can be altered slightly to
make it run faster.
• First of all all we care about is finding
• Second any where m gt n-1 matches n-1.

28
Technique of Repeated Squaring.
• As it turns out
• So we can square it we can get
• 1, 2, 4, 8 which may in some cases be larger then
n-1 but that is fine since any matrix larger then
n-1 is identical to n-1.

29
(No Transcript)
30
Chan O(n3/logn)
• Type - All Pairs Shortest Path
• Runtime - O(n3/logn)
• Input - Weighted Directed Graph
• Output - (Still trying to figure that one out)

31
Questions?
32
Bibliography
• D59 E. W. Dijkstra A Note on two Problems in
Connection with Graphs. Numerical Mathematics,
1(5)269-271, 1959
• C08 Timothy M. Chan All-Pairs Shortest Paths
with Real Weights in O(n3/logn) Time.
Algorithmica 2(50)236-243, 2008
• CLR07 Thomas H. Cormen, Charles E. Leiserson,
Ronald L Rivest, and Clifford Stein.
Introduction to Algorithms 2nd Edition 2007.