CSA Functions

Algorithms.CSA.csa_functions.initialize_csa(SOURCE: int, WALKING_FROM_SOURCE: int, footpath_dict: dict, D_TIME)tuple[source]

Initialize values for CSA.

Parameters
  • SOURCE (int) – stop id of source stop.

  • WALKING_FROM_SOURCE (int) – 1 or 0. 1 indicates walking from SOURCE is allowed.

  • footpath_dict (dict) – preprocessed dict. Format {from_stop_id: [(to_stop_id, footpath_time)]}.

  • D_TIME (pandas.datetime) – departure time.

Returns

dict to maintain best arrival label {stop id: pandas.datetime}. trip_set(dict): dict to check if a trip has been scanned or not{ trip id: boolean}. pi_label(dict): dict used for backtracking labels. Format {stop id : label}. label is (“walking”, from stop, to_stop, footpath duration) or (‘connection’, connection id) inf_time (pandas.datetime): Variable indicating infinite time.

Return type

stop_label(dict)

Algorithms.CSA.csa_functions.load_connections_dict(NETWORK_NAME: str)list[source]

loads connection array.

Parameters

NETWORK_NAME (str) – Network name

Returns

list of connections. Format: [[connection id, fro stop, to stop, from time, to time, trip id]]

Return type

connections_list (list)

Algorithms.CSA.csa_functions.post_process_csa(SOURCE: int, DESTINATION: int, pi_label: dict, PRINT_ITINERARY: int, connections_list: list, stop_label: dict, inf_time)tuple[source]

Post processing functions for CSA. Currently supported functionality are 1. Print complete journey

Parameters
  • SOURCE (int) – stop id of source stop.

  • DESTINATION (int) – stop id of destination stop.

  • D_TIME (pandas.datetime) – departure time.

  • pi_label (dict) – dict used for backtracking labels. Format {stop id : label}. label is (“walking”, from stop, to_stop, footpath duration)

  • PRINT_ITINERARY (int) – 1 or 0. 1 means print complete path.

  • connections_list (list) – list of connections. Format: [[connection id, fro stop, to stop, from time, to time, trip id]]

  • stop_label (dict) – dict to maintain best arrival label {stop id: pandas.datetime}.

  • inf_time (pandas.datetime) – Variable indicating infinite time.

Returns

If the destination is not reachable (None), else tuple containing the best arrival time.

Return type

output (tuple)