iduedu.mode_graph¶
- iduedu.mode_graph(street_graph, mode, *, simplify=True, keep_largest_subgraph=False)[source]¶
Take the graph of one mode from a street graph of
get_street_graph().The graph holds the edges the mode may use in at least one direction, with
time_minfrom the time of the mode, and the nodes of those edges. Walking gives an undirected graph. Driving and cycling give directed graphs with anonewaycolumn, as their builders do; an edge the mode may use only against its drawing is turned (uandvswap and the geometry is reversed). Withsimplifythe edges are merged through the nodes that have only two edges of this mode (seesimplify_graph()), so a road is not cut where only a footway joins it.- Parameters:
street_graph (
UrbanGraph) – Graph ofget_street_graph().mode (
Literal['walk','drive','bike']) –"walk","drive"or"bike".simplify (
bool) – Merge chains of edges through nodes of degree two of this mode.keep_largest_subgraph (
bool) – Keep only the largest connected part (strongly connected for driving and cycling).
- Returns:
Multigraph of type
modewith the columns of the matching builder.- Return type:
- Raises:
ValueError – If the street graph has no columns for
mode.