Route Finding in Time Dependent Graphs - Nima Montazeri and Ben Earlam @ GraphConnect NY 2013

2,013 views
1,765 views

Published on

Nima and Ben will share some of the experiences of modelling Manchester’s Metrolink network while building a real-life application – Tramchester.

Published in: Technology, Education
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
2,013
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
45
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Route Finding in Time Dependent Graphs - Nima Montazeri and Ben Earlam @ GraphConnect NY 2013

  1. 1. Ben Earlam [@BenEarlam] Nima Montazeri [@Nimamon] [Presented By] Route Finding in Time Dependent Graphs [Located]
  2. 2. What are we going to cover? Introduction Why Graph? About The Data Time Independent Model Time-dependent Model Demo Q&A
  3. 3. How it all started? Experiment & Learn Real world problem 5 Week tech lab Produce working software Small team
  4. 4. Manchester
  5. 5. The Focus… Travel & Transport (Manchester) Open Data Open Source Metrolink System (25 Million Journeys p/a) Tech: Not Only SQL • Neo4J Experiment with Graph database as way of modeling a travel network Everything in the Cloud (AWS)
  6. 6. Tram Network
  7. 7. Why Graph database? 5 2 3 2 5 3 2 2 Map © Transport for Greater Manchester 2013
  8. 8. Tram Data… Tabular Data in text file (General Transit Feed Specification) 250 Cities publish GTFS data http://www.gtfs-data-exchange.com/agency/mta-new-york-citytransit/ Stops Stop_id Stop Times Trip_id Trips Service_id Route_id Routes Calendar
  9. 9. Earliest Arrival Time Problem Earliest Arrival Time (EAT) attempts to find the path through a network from source to destination, such that given a start time T we arrive at the destination at the earliest possible time after T.
  10. 10. Starting point… G1 G2 2 2 F1 7 [goes_to] A2 3 3 [goes_to] B1 [platform] [platform] A1 F2 C1 4 7 B2 4 C2
  11. 11. Iterations 1 2 3 4
  12. 12. Time Independent 3 B [goes_to] R1 C C D [Depart] [board] A 4 [Depart] [board] [goes_to] R1 B [Depart] [board] R1 A R2 B 5 [goes_to] R2 D
  13. 13. Applying the timetable Paths Timetable Invalid Paths Valid Paths
  14. 14. Different Graph at each point in time…
  15. 15. Different Graph at each point in time… Example: A -> E A B D C E 9:30 AM / Friday F
  16. 16. Different Graph at each point in time… Example: A -> E A B D C E 9:30 AM / Saturday F
  17. 17. Different Graph at each point in time… Example: A -> E A B D C E 10:00 AM / Saturday F
  18. 18. Modeling Time Time Expanded Model • Model temporal events as Nodes – – Arrivals – Department – Transfers • Duration as edge weight, use Dijkstra to find EAT Time Dependent Model • Model temporal data as properties • Model all distinct routes with 2 Node types –  Station  Station Route • Use modified Dijsktra to perform Travel Time Function during traversal
  19. 19. Time Dependent Model 3 [board] [goes_to] [goes_to] R1 C B [Depart] A 4 R1 B [Depart] [board] R1 A C
  20. 20. Modeling Time… Up to 900 Trams… A [T2] [T3] [T4] [T5] [T6] [T7] [T8] [T9] [T2] [T3] [T4] [T5] R1 B [board] 09:40 09:50 10:10 10:20 10:30 10:40 10:50 11:00 [Depart] [board] R1 A [T1] 09:33 300 Nodes 100K Relations 300K Properties B 09:43 09:53 10:13 10:23 [T7] 10:43 [T8] 10:53 [T9] 11:03 R1 C [Depart] [T1] 09:30 C
  21. 21. Modeling Time… "Time is a dimension in which events can be ordered from the past through the present into the future.” - Wikipedia
  22. 22. Modeling Time… 10:15 A [T2] [T3] [T4] [T5] [T6] [T7] [T8] [T9] [T2] [T3] [T4] [T5] R1 B [board] 09:40 09:50 10:10 10:20 10:30 10:40 10:50 11:00 [Depart] [board] R1 A [T1] 09:33 B 09:43 09:53 10:13 10:23 [T7] 10:43 [T8] 10:53 [T9] 11:03 R1 C [Depart] [T1] 09:30 C
  23. 23. Traversal Framework Traversal Framework Evaluator Path Expander Branch Selector
  24. 24. Path Expander The traversal framework use PathExpanders to discover the relationships that should be followed from a particular path to further branches in the traversal. public class TripPathExpander implements PathExpander<GraphState> { public Iterable<Relationship> expand(…) { } }
  25. 25. The App • http://www.tramchester.co.uk/
  26. 26. Any Questions? Follow us on Twitter: @tramchester
  27. 27. Traversal Framework Declarative Java API It enables the user to specify a set of constraints that limit the parts of the graph the traversal is allowed to visit Can specify which relationship types to follow, and in which direction (effectively specifying relationship filters) Can specify a user-defined path evaluator that is triggered with each node encountered
  28. 28. A nice problem to have…
  29. 29. Stop Trip Arr. Dept. 1 12:00 12:01 B 1 12:05 12:05 C 1 12:10 C 2 12:11 D 2 12:16 C 3 12:20 D 3 12:26 A Example - Time Dependent Model T1 Arr.12:00 Dept.12:01 R1 B T1 Arr.12:05 Dept.12:05 T2 Arr.12:10 Dept.12:21 T3 Arr.12:20 Dept.12:26 B R1 C R1 D C [Depart] [Depart] [board] A 12:21 [board] [board] [Depart] [board] R1 A 12:11 D
  30. 30. Spatial Indexes A B C D P

×