iduedu.simplify_multiedges¶
- iduedu.simplify_multiedges(graph, *, weight='time_min', rule='min')[source]¶
Collapse a multigraph
UrbanGraphinto a simple graph.For each node pair, one edge is selected according to
weightandrule.rule="min"keeps the edge with the smallest weight, whilerule="max"keeps the edge with the largest weight.- Parameters:
graph (
UrbanGraph) – Source urban graph.weight (
str) – Edge column used to choose the representative edge.rule (
Literal['min','max']) – Selection rule, either"min"or"max".
- Return type:
- Returns:
New
UrbanGraphwithis_multigraph=False.- Raises:
TypeError – If
graphis not anUrbanGraph.KeyError – If
weightis absent fromedges_gdf.ValueError – If weights contain
NaNorruleis unsupported.