iduedu.urban_graph2nx_graph¶
- iduedu.urban_graph2nx_graph(urban_graph)[source]¶
Convert an
UrbanGraphto a NetworkX graph.NetworkX is not required for normal IduEdu workflows, but this conversion is useful at integration boundaries with tools that consume NetworkX graph objects.
- Parameters:
urban_graph (
UrbanGraph) – Tabular urban graph to convert.- Return type:
A directed graph with an edge direction column (
oneway) becomes an undirected NetworkX graph whose edges keep that column and their geometry drawn fromutov, asnx_graph2urban_graph()reads them back. An undirectedMultiGraphkeys the edges of a pair of nodes, not of a direction, so an edge whose key the opposite edge already holds (boarding and alighting, two one-way carriageways) gets the next free key.- Return type:
- Returns:
networkx.Graph,networkx.DiGraph,networkx.MultiGraphornetworkx.MultiDiGraphwith node and edge attributes copied from the UrbanGraph tables.- Raises:
ValueError – If a graph without parallel edges would become an undirected
networkx.Graphwhile two of its edges join the same nodes (utovandvtou): such a graph holds one of them only.- Parameters:
urban_graph (UrbanGraph)