flownet provides efficient tools for transportation modeling in R, supporting network processing, route enumeration, and traffic assignment tasks. It implements the path-sized logit (PSL) model for traffic assignment and provides powerful utilities for network processing/preparation.
Network Processing
linestrings_to_graph() --- Convert LINESTRING geometries to graph
create_undirected_graph() --- Convert directed graph to undirected
consolidate_graph() --- Consolidate graph, removing redundant nodes/edges
simplify_network() --- Spatially simplify network graph
Traffic Assignment
run_assignment() --- Run traffic assignment using path-sized logit model
Graph Utilities
normalize_graph() --- Normalize node IDs to consecutive integers
nodes_from_graph() --- Extract unique nodes from graph
linestrings_from_graph() --- Convert graph to LINESTRING geometries
distances_from_graph() --- Compute distance matrix from graph
OD Matrix Utilities
melt_od_matrix() --- Convert origin-destination matrix to long format
Data
africa_trade --- Average BACI HS96 2012-22 trade flows by section between 47 continental African countries
africa_cities_ports --- The 453 largest (port-)cities in continental Africa within a 70km radius - from Krantz (2024), tools:::Rd_expr_doi("10.1596/1813-9450-10893")
africa_network --- African continental road network + extensions to optimally connect the 453 cities - from Krantz (2024), tools:::Rd_expr_doi("10.1596/1813-9450-10893")
africa_segments --- Primary segments derived from OpenStreetMap routes between the 453 cities - from Krantz (2024), tools:::Rd_expr_doi("10.1596/1813-9450-10893")
Replication materials: https://github.com/SebKrantz/OptimalAfricanRoads
Sebastian Krantz sebastian.krantz@graduateinstitute.ch and Kamol Roy kamol.roy08@gmail.com
The package uses efficient C implementations for critical path operations and leverages:
collapse - Fast data transformations
geodist - Fast geodesic distance computations
igraph - Graph operations and shortest path algorithms
leaderCluster - Fast spatial clustering for network simplification
Ben-Akiva, M., & Bierlaire, M. (1999). Discrete choice methods and their applications to short term travel decisions. In R. W. Hall (Ed.), Handbook of Transportation Science (pp. 5-33). Springer US. tools:::Rd_expr_doi("10.1007/978-1-4615-5203-1_2")
Cascetta, E. (2001). Transportation systems engineering: Theory and methods. Springer.
Ben-Akiva, M., & Lerman, S. R. (1985). Discrete choice analysis: Theory and application to travel demand. The MIT Press.
Ramming, M. S. (2002). Network knowledge and route choice (Doctoral dissertation). Massachusetts Institute of Technology.
Prato, C. G. (2009). Route choice modeling: Past, present and future research directions. Journal of Choice Modelling, 2(1), 65-100. tools:::Rd_expr_doi("10.1016/S1755-5345(13)70005-8")
AequilibiaE Python Documentation: https://www.aequilibrae.com/develop/python/route_choice/path_size_logit.html