Metapath Analysis

The Metapath Analysis panel connects amenities through the street network using city2graph’s metapath workflow. It builds a street dual graph (segments as nodes), bridges amenities to their nearest segments, and materializes amenity-to-amenity paths — either by a fixed number of street hops (add_metapaths) or by an accumulated cost band (add_metapaths_by_weight).

The panel is organized as a root with shared inputs and four subpanels that follow the city2graph pipeline: choose a materialization strategy, inspect the result, or drive the raw stages.

Important

Two inputs are required: an OSMnx street network must be the active object in the 3D viewport, and an amenities feature object must be chosen in the root panel. Amenity objects can come from OSMnx feature downloads (is_osm_features) or City2Graph Data Import (is_city2graph); a green checkmark with the feature count confirms a valid choice. Denser amenity sets (e.g. buildings) produce many more edges than sparse POI tags.

Root — shared inputs

Section Control Description
Street Network (active object) Confirms the active OSMnx network (or an existing dual graph).
Amenities Amenities object The feature object whose points become the metapath endpoints.
Graph Construction Bridge K Nearest segments each amenity is bridged to (KNN).
Graph Construction Amenity Limit Maximum amenities analyzed, for performance.

The dual graph and the KNN bridge are built automatically by both strategies, so these inputs are shared.

Subpanel — Materialize by Hops

Implements add_metapaths: the amenity → segment (×N) → amenity sequence.

Control Description Default
Street Hops Number of segment-to-segment hops in each metapath. 3 (1–10)
Viz Limit Maximum metapaths drawn as curves. 200 (10–1000)
Curve Thickness Bevel depth of the metapath curves. 0.0002
Materialize Metapaths Builds the dual graph, bridges amenities, and computes the hop-based metapaths in one run.
Tip

More edges come from more amenities and more connectivity: raise Street Hops, Bridge K, and Amenity Limit, and feed a dense amenities object (buildings).

Subpanel — Materialize by Weight

Implements add_metapaths_by_weight: connect endpoints reachable within an accumulated cost band (Dijkstra).

Control Description
Cost Attribute Edge attribute used as cost (e.g. length, travel_time).
Max Cost Upper bound of the cost band.
Min Cost Lower bound (excludes very short connections).
Endpoint Type Node type to connect (e.g. amenity).
Materialize by Weight Runs the Dijkstra-based computation.
Note

This strategy reuses the bridged dual graph. Run Materialize by Hops (or the step-by-step bridge stage) at least once so the bridges exist.

Subpanel — Result & Inspect

Appears only when a dual graph or metapath object is active.

Object Reported fields
Street Dual Graph Segments (nodes), connections (edges), and bridge count once amenities are bridged.
Metapath Result Total vs unique paths, hop count, multiplicity range/average, and visualized curve count.
Metapath Mesh Total/unique paths and whether the multiplicity edge attribute is available.

Convert to Mesh (Spreadsheet) turns a metapath result into a mesh whose edge domain carries a multiplicity attribute, inspectable in the Spreadsheet editor (set the domain to Edge).

Subpanel — Advanced (Step-by-Step)

Run the individual pipeline stages on the active object for debugging or fine control:

Step Operator Result
1. Create Street Dual Graph Builds the segment-as-node dual graph from the OSMnx network. A *_StreetDual object.
2. Bridge Amenities Connects amenities to their nearest segments on the dual graph. Adds bridges (*_Bridges).
3. Compute Metapaths Traces hop-based paths between amenities. A *_Metapaths_<n>hop object.

Step-by-step tutorial

For a worked example using Burjassot, follow Analyze metapaths.

Back to top