aequilibrae.transit.TransitGraphBuilder#

class aequilibrae.transit.TransitGraphBuilder(public_transport_conn, period_id: int = 1, time_margin: int = 0, projected_crs: str = 'EPSG:3857', num_threads: int = -1, seed: int = 124, geometry_noise: bool = True, noise_coef: float = 1e-05, with_inner_stop_transfers: bool = False, with_outer_stop_transfers: bool = False, with_walking_edges: bool = True, distance_upper_bound: float = inf, blocking_centroid_flows: bool = True, connector_method: str = 'nearest_neighbour', max_connectors_per_zone: int = -1)[source]#

Graph builder for the transit assignment Spiess & Florian algorithm.

Arguments:

public_transport_conn (sqlite3.Connection): Connection to the public_transport.sqlite database.

period_id (int): Period id for the period to be used. Preferred over start and end.

time_margin (int): Time margin, extends the start and end times by time_margin ([start, end] becomes [start - time_margin, end + time_margin]), in order to include more trips when computing mean values. Defaults to 0.

projected_crs (str): Projected CRS of the network, intended for more accurate distance calculations. Defaults to "EPSG:3857", Spherical Mercator.

num_threads (int): Number of threads to be used where possible. Defaults to -1, using all available threads.

seed (int): Seed for self.rng. Defaults to 124.

geometry_noise (bool): Whether to use noise in geometry creation, in order to avoid colocated nodes. Defaults to True.

noise_coef (float): Scaling factor of the noise. Defaults to 1.0e-5.

with_inner_stop_transfers (bool): Whether to create transfer edges within parent stations. Defaults to False.

with_outer_stop_transfers (bool): Whether to create transfer edges between parent stations. Defaults to False.

with_walking_edges (bool): Whether to create walking edges between distinct stops of each station. Defaults to True.

distance_upper_bound (float): Upper bound on connector distance. Defaults to np.inf.

blocking_centroid_flows (bool): Whether to block flow through centroids. Defaults to True.

max_connectors_per_zone (int): Maximum connectors per zone. Defaults to -1 for unlimited.

__init__(public_transport_conn, period_id: int = 1, time_margin: int = 0, projected_crs: str = 'EPSG:3857', num_threads: int = -1, seed: int = 124, geometry_noise: bool = True, noise_coef: float = 1e-05, with_inner_stop_transfers: bool = False, with_outer_stop_transfers: bool = False, with_walking_edges: bool = True, distance_upper_bound: float = inf, blocking_centroid_flows: bool = True, connector_method: str = 'nearest_neighbour', max_connectors_per_zone: int = -1)[source]#

Methods

__init__(public_transport_conn[, period_id, ...])

add_zones(zones[, from_crs])

Add zones as ODs.

convert_demand_matrix_from_zone_to_node_ids(...)

Convert a sparse demand matrix from ``zone_id``s to the corresponding ``node_id``s.

create_additional_db_fields()

Create the additional required entries in the tables.

create_graph()

Create the SF transit graph (vertices and edges).

create_line_geometry([method, graph])

Create the LineString for each edge.

create_od_node_mapping()

Build a dataframe mapping the centroid node ids with to transport assignment zone ids.

from_db(public_transport_conn, period_id, ...)

Create a SF graph instance from an existing database save.

save([robust])

Save the current graph to the public transport database.

save_config()

save_edges([recreate_line_geometry])

Save the contents of self.edges to the public transport database.

save_vertices([robust])

Write the vertices DataFrame to the public transport database.

to_transit_graph()

Create an AequilibraE (TransitGraph) object from an SF graph builder.

Attributes

config