run_assignment() @details
section using \subsection{} for better organization:
return.extra parameter documentation as a clear
table showing which options are available for each methodpaths returns edge indices, not node
indicesnthreads parameterrun_assignment() (AoN and PSL methods)normalize_graph(), nodes_from_graph(),
distances_from_graph()linestrings_to_graph(),
linestrings_from_graph(),
create_undirected_graph()consolidate_graph(),
simplify_network()melt_od_matrix()simplify_network() shortest-paths methodrun_assignment(): Core function for
traffic assignment using the path-sized logit (PSL) model
mirai.linestrings_to_graph(): Convert
LINESTRING geometries (sf objects) to graph data frames
create_undirected_graph(): Convert
directed graphs to undirected graphs
collapse::collap() with
customizable functionsconsolidate_graph(): Simplify network
topology by removing intermediate nodes
simplify_network(): Simplify networks
using shortest-paths or spatial clustering methods
leaderCluster algorithm and contracts the graphnormalize_graph(): Normalize node IDs
to consecutive integers starting from 1
nodes_from_graph(): Extract unique
nodes with coordinates from graph
linestrings_from_graph(): Convert
graph data frames back to LINESTRING geometries
linestrings_to_graph()distances_from_graph(): Compute
distance matrices for all node pairs
melt_od_matrix(): Convert
origin-destination matrices to long format
africa_network: A road transport
network with 2,825 LINESTRING features representing existing roads
(2,344 edges) and proposed new links (481 edges). Each edge includes
attributes such as distance, travel duration, border crossing costs,
terrain ruggedness, and road upgrade costs.
africa_cities_ports: 453 African
cities with population > 100,000 and international ports. Includes
population data, capital status, and port cargo outflows.
africa_segments: 14,358 raw network
segments representing intersected road routes. Useful for demonstrating
network consolidation and simplification functions.
africa_trade: Bilateral trade flows
between 47 African countries aggregated by HS section (21 product
categories). Values represent annual averages over 2012-2022.
The africa_network, africa_cities_ports,
and africa_segments datasets are from Krantz, S. (2024). Optimal Investments in
Africa’s Road Network. Policy Research Working Paper 10893. World
Bank. Replication materials are available at github.com/SebKrantz/OptimalAfricanRoads.
collapse package for fast data
transformationsigraph for graph operations and shortest path
algorithmsgeodist for fast geodesic distance
computationsleaderCluster for efficient spatial
clustering?flownet-packageGPL-3