April 2019
Beginner
190 pages
4h 54m
English
Using the residuals, it is possible to produce a residual network, consisting only of the edges that exceed their expected traffic. This network represents, in some ways, the most important airport connections. The residual network can be found by storing the edges in a list and using the edge_subgraph() method of the Graph class:
residual_edges = [e for e in G_air.edges if G_air.edges[e]['log_residual'] > 0]G_residual = G_air.edge_subgraph(residual_edges)# Keep the largest connected componentG_residual = nx.subgraph(G_residual, max(nx.connected_components(G_residual), key=len))
The residual network is visualized just as before:
fig = plt.figure(figsize=(15,15))ax = plt.subplot(1, 1, 1)max_weight = max([G_residual.edges[e]['log_residual'] ...
Read now
Unlock full access