Skip to content

Create a graph for Spiess & Florian's algorithm from the transit data model

François Pacull edited this page Jun 16, 2023 · 2 revisions

The GTFS for the Lyon test case has been imported into the transit database. The goal is to create the graph for the assignment using Spiess & Florian's algorithm.

Assumptions

In the first approach, we do not deal with:

  • fares
  • vehicle capacity

This will be dealt with in another iteration.

Input tables

We are going to use the 5 following tables:

  • stops
  • routes
  • route_links
  • trips
  • trips_schedule

stops

shape: (4496, 13)

stop_id stop agency_id link dir name parent_station description street fare_zone_id transit_zone route_type geometry
dtype int64 object int64 object object object object object object object object int64 object
example 10000000002 2 1 None None Thurins Mairie 1 None None 1 b"\x00\x01\xe6\x10\x00\x00'\xf6\xd0>V\x90\x12@...
nunique 4496 4496 1 0 0 2049 2054 1 1 0 0 1 2054

Remarks (for the present case):

  • stop, parent_station could be of int64 type
  • link, dir, description (""), street (""), fare_zone_id and transit_zone are empty
  • rout_type is always 1

routes

shape: (475, 11)

pattern_id route_id route agency_id shortname longname description route_type seated_capacity total_capacity geometry
dtype int64 int64 object int64 object object object int64 int64 int64 object
example 10001001000 10001000000 11 1 11 1 280 560 b'\x00\x01\xe6\x10\x00\x00'\xf6\xd0>V\x90\x12...
nunique 475 141 141 1 1 141 1 1 1 1 465

Remarks (for the present case):

  • route could be of int64 type
  • shortname (""), description ("") are empty
  • rout_type is always 1

route_links

shape: (9637, 7)

transit_link pattern_id seq from_stop to_stop distance geometry
dtype int64 int64 int64 int64 int64 float64 object
example 20000001 10001001000 0 10000000002 10000000006 353.155972 b"\x00\x01\xe6\x10\x00\x00'\xf6\xd0>V\x90\x12@...
nunique 9637 475 46 4435 4401 2650 4613

trips

shape: (17653, 4)

trip_id trip dir pattern_id
dtype int64 object int64 int64
example 10001001001 1 0 10001001000
nunique 17653 17653 1 475

Remarks (for the present case):

  • trip could be of type int64

trips_schedule

shape: (388377, 4)

trip_id seq arrival departure
dtype int64 int64 int64 int64
example 1.0001e+10 0 21600 21600
nunique 17653 47 10095 10095

Remarks:

  • arrival and departure times are expressed in seconds from 00h00m00