Post #2458674
2026-04-22 18:44 UTC
[g.subgraph(c).copy() for c in sorted(nx.connected_components(g), key=lambda c: sum([l[-1] for l in g.subgraph(c).copy().edges.data('length')]), reverse=True)]
Finally came up with this one line of code.. it gives me #network components ordered by total link length. Is this pythonic? 😅 :networkx:
Replies (1)
-
@gntert@mastodon.social 2026-04-22 18:57
@mszll@datasci.social 🫣