I am using NetowrkX and OsmnX Python packages to analyze a road network. Once I obtained the simplified graph, I would like to evaluate the performance of the network through the shortest path calculation. In order to obtain a specific index, I need the length of the shortest paths that include selected edges that are shortest paths through the motorway edges.
First I listed the motorway edges which I am interested in (G5 is the corresponding graph of my network):
MW_edges=[(u,v,k,d) for u,v,k,d in G5.edges(keys=True, data=True) if d['highway']=='motorway']
I used the following function to evaluate the shortest paths in the network for all pairs of nodes:
paths=dict(nx.all_pairs_dijkstra_path(G5, cutoff=None, weight='length'))
How can obtain/extract the demanded shortest paths including motorway edges?