Download presentation
Presentation is loading. Please wait.
1
Alexander Krahn Danielle Jacoby Tim Knor
CartoGraph Alexander Krahn Danielle Jacoby Tim Knor
2
Problem Definition How do we find the “best” path between two points on a map? Will the user define “best” as the fastest or shortest path? What constraints determine the path the user should take?
3
Map Representation Directed, dynamically weighted graph
Each edge has properties such as speed limit, length, number of lanes, number of stop signs and stoplights, and peak traffic times Each vertex represents an intersection between two or more roads
4
Input Map Format // x-bound y-bound #roads #intersections
// List coordinates of all intersections FIRST … // name, unique_parts #_of_dirs Main Street, 2 2 // #_of_ints speed morning evening lanes; int int stop? stop? … ; 0 1 S N 1 2 S S ; 3 4 N S First Street, 1 1
5
Request Format Types of REQUEST Shortest Path Time Distance Stops
[SOURCE] intersection Street #1 intersection Street #2 [DESTINATION] [REQUEST] TIME X DISTANCE X STOPS X Types of REQUEST Shortest Path Time Distance Stops Combinations of time and distance Shortest Path with limit on stops Shortest Distance with limit on time Shortest Time with limit on distance
6
Algorithm Dijkstra's algorithm finds the shortest path on a graph between the source and the destination Time for this algorithm is O(N2), where N is the number of vertices This algorithm is suited for dealing with weighted edges
7
Algorithm DIJKSTRA(G, s, w) G - Graph for each vertex u in V
Gd[u] := infinity Gp[u] := u Gcolor[u] := WHITE Sd[u] := infinity Sp[u] := u Scolor[u] := WHITE end for Gcolor[s] := GO Gd[s] := 0 INSERT(GH, s) for number of stops ... return (d, p) G - Graph s - source w – weight Gd - distance Gp - predecessor GH - heap of GO nodes Gcolor - status of vertex WHITE = untouched GO = considering Sd - distance Sp - predecessor SH – heap of STOP nodes Scolor - status of vertex STOP = stopped
8
Algorithm DIJKSTRA(G, s, w) G - Graph ... s - source
for number of stops while (GH != Ø) u := EXTRACT-MIN(GH) for each vertex v in Adj[u] if (STOP(u,v)) if (w(u,v) + Sd[u] < Sd[v]) Sd[v] := w(u,v) + Sd[u] Sp[v] := u if (Scolor[v] = WHITE) Scolor[v] := STOP INSERT(SH, v) else if (Scolor[v] = STOP) DECREASE-KEY(SH, v) else if (w(u,v) + Gd[u] < Gd[v]) Gd[v] := w(u,v) + Gd[u] Gp[v] := u if (Gcolor[v] = WHITE) Gcolor[v] := GO INSERT(GH, v) else if (Gcolor[v] = GO) DECREASE-KEY(GH, v) end for end while G - Graph s - source w – weight Gd - distance Gp - predecessor GH - heap of GO nodes Gcolor - status of vertex WHITE = untouched GO = considering Sd - distance Sp - predecessor SH – heap of STOP nodes Scolor - status of vertex STOP = stopped
9
Algorithm DIJKSTRA(G, s, w) G - Graph ... s - source w – weight
for number of stops while (SH != Ø) u := EXTRACT(SH) if (Gd[u] > Sd[u]) Gd[u] = Sd[u] Gp[u] = Sp[u] INSERT(GH, u) end while end for return (d, p) G - Graph s - source w – weight Gd - distance Gp - predecessor GH - heap of GO nodes Gcolor - status of vertex WHITE = untouched GO = considering Sd - distance Sp - predecessor SH – heap of STOP nodes Scolor - status of vertex STOP = stopped
10
3 4 D 3 4 5 5 7 2 3 1 2 2 S 1 1
11
3 4 5 3 4 5 5 7 2 3 1 2 2 1 1 1
12
3 4 5 8 3 4 5 5 7 2 3 1 2 2 1 1 1
13
3 4 5 8 12 3 4 5 5 7 2 3 1 2 2 1,15 1 1
14
3 4 5 8 12 3 4 5 5 7 2 3 1 2 2 1,15 15 1 1
15
3 4 5 8 12 3 4 5 5 7 2 3 1 2 2 1,15 16,15 1 1
16
3 4 5 8 12 3 4 5 5 7 2 3 1 2 2 1,15 16,15 15 1 1
17
3 4 5 8 12 3 4 5 5 7 2 3 1 2 2 1,15 16,15 1 1 1 < 15 16 > 15
18
3 4 5 8 12 3 4 5 5 7 2 3 1 2 2 1 15 1 1
19
3 4 5 3 12 3 4 5 5 7 2 3 1 2 2 1 2,15 1 1
20
3 4 5 3 7 3 4 5 5 7 2 3 1 2 2 1 2,15 1 1
21
3 4 5 3 7 3 4 5 5 7 2 3 1 2 2 1 2,10 1 1
22
3 4 5 3 7 3 4 5 5 7 2 3 1 2 2 1 2,10 10 1 1
23
3 4 5 3 7 3 4 5 5 7 2 3 1 2 2 1 2,10 1 1 2 < 10
24
3 4 5 3 7 3 4 5 5 7 2 3 1 2 2 1 2 1 1
25
3 4 5 3 3 3 4 5 5 7 2 3 1 2 2 1 2 1 1
26
3 4 5 3 3 3 4 5 5 7 2 3 1 2 2 1 2 1 1
27
Text Output Format Text output will give turn-by-turn directions to the user between the source and destination For example: Begin on Main Street, drive 3.4 miles Turn right onto First Street, drive 0.05 miles to First Street and Pine Road
28
MATLAB Output Format
29
Edge Constraints To determine the best path in terms of time, there are many factors to consider Speed limit and adjusted speed during heavy traffic Number of lanes Number of stop signs and stoplights Distance
30
Edge Constraints To determine the best path in terms of distance, the weights on the edges are essentially removed In this case, the actual shortest path is found The user will be able to choose whether their path concerns time or distance
31
Edge Constraints for each edge e tempspeed=e.speed for w=1 to e.width
tempspeed=tempspeed(1+0.02) endfor e.mornweight=[e.distance/(tempspeed*e.morn)]+ S/N e.eveweight=[e.distance/(tempspeed*e.eve)]+ S/N e.normweight=(e.distance/tempspeed)+S/N if tempspeed>e.speed then tempspeed=e.speed endforeach
32
VLSI Application This problem is related to the VLSI routing problem
Edge constraints are related to resistance, capacitance, bandwidth, and channel size Detours are related to buffers and amplifiers
33
Project Responsibilities
Danielle will be creating input maps and is in charge of parsing the input maps into the graph data structure. She is also in charge of generating both output files. Tim is in charge of the weighting scheme and will also be coding the main file to read in user requests and implement the algorithm.
34
Project Responsibilities
Zander is responsible for improving the speed of Dijkstra’s algorithm and also for modifying the algorithm to better fit our needs. Of course, all of our jobs require extensive interaction.
35
Sources Pictures from:
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.