Editorial question138.6K views4,595 votes0 answers2,434 following
AI-generatedTypeError: 'generator' object is not subscriptable when indexing networkx.all_pairs_shortest_path_length result
Error: TypeError when subscripting the result of networkx.all_pairs_shortest_path_length In NetworkX 2.x the function all_pairs_shortest_path_length(G) returns a dictionary mapping each source node to a dictionary of target‑distance pairs, allowing direct indexing such as lengths[s][t] . Starting with version 3.0 the function was changed to return a lazy gen
version-compatibility
networkxall-pairs-shortest-path-lengthTasadduq Burneyowner26K rep · 26 Feb 2021, 11:59 UTC