Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

networkx edges between subgraphs

$
0
0

I have a Graph (G) where nodes are split into two distinct subgraphs (H, I). The nodes within each subgraph are interconnected. What I'm looking for is a list of edges that are connections between the subgraphs and only those in a way thats somewhat scaleable to big graphs.

Setup:

import networkx as nxG = nx.path_graph(10)H = nx.subgraph(G, [0,1,2,3,4])I = nx.subgraph(G, [5,6,7,8,9])G.add_edge(1,7)G.add_edge(2,9)

Output I want:

 [(4,5),(1,7),(2,9)]

enter image description here


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>