Skip to content

PhilChodrow/riyadh_multiplex

Repository files navigation

Multiplex Metro

Purpose

This repo contains code for the Riyadh Multiplex Metro project's analytical pipeline. Data prep and analysis are written in discrete Python scripts, which are then structured into a pipeline via GNU Make. The terminal command make all in this directory will execute the analysis to the full extent of its latest implementation. The analysis currently includes the following scripts and source files:

Data

The data directory includes the following data sets

  1. street, comprising street_nodes.txt and street_edges.txt
  2. metro, comprising metro_nodes.txt and metro_edges.txt
  3. taz, comprising taz_connectors.txt
  4. taz_od, comprising 8 different files of origin-destination flow data. The one currently used in the pipeline and published analysis is 0_1.txt.
  5. google_times.txt, a data frame of google travel time estimates used for validation.

Modules

The following modules are all contained in the package metro. A short vignette for this package is included in the /metro subdirectory. To import one of the modules, use syntax as in the following:

    from metro import multiplex as mx
  1. multiplex.py : a Python class definition that implements a relatively thin wrapper around the networkx.DiGraph class for handling multilayer networks.
  2. utility.py : a collection of functions for interacting with multiplex objects, including modifying their attributes and extracting information for further analysis.
  3. analysis.py : a collection of functions for analytical computations involving multiplex objects.
  4. viz.py : a collection of functions for visualizations of multiplex objects.
  5. ita.py : a collection of functions for performing ITA-like calculations, including shortest paths, with a multiplex object.

Scripts

  1. make_multiplex.py : a Python script for constructing a multiplex object using data in the 1_data directory. This script saves the resulting multiplex as nodes and edges in the 2_multiplex directory.
  2. scale_edge_weights.py : a Python script for scaling the edge weights of the multiplex by a fixed constaint. Typically applied to travel time weights like uniform_time_m, free_flow_time_m, and congested_time_m. Default used in the makefile is 1.51.
  3. assign_flows.py : A Python script that performs repeated ITA for varying levels of metro speed.
  4. simulation.py : a Python script for performing the simulations of uniform and targeted adoption scenarios described in the published article.

Other

  1. makefile : a makefile automating the data preparation and analysis pipeline. Cloning the repo and running make all at the terminal will perform all steps in the data preparation pipeline.

Figures

Figures are generated by the included set of .ipynb files. These files already contain the appropriate figures, but can be re-run in any program supporting .ipynb files to reproduce the figures as needed.

Performance

Note that assign_flows.py and simulation.py will take a long time (multiple days) to run, IF the summary = True parameter is passed to the corresponding calls to the ita function. Changing summary = FALSE will dramatically improve performance, but will not print out a complete table of routes taken by each traveler in each assignment.

About

Repository for article "Demand and Congestion in Multiplex Transportation Networks"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published