Subgraph

37 views
Skip to first unread message

ashwani sharma

unread,
Dec 14, 2009, 3:17:25 AM12/14/09
to networkx...@googlegroups.com
Hi Friends,

I have a problem related to subgraph. Lets say I have 2 files one parent.txt (which is for parent graph) and a subgraph.txt (which is for subgraph).
I have been using subgraph(G,nbunch,copy=true) function to derive a subgraph but it generates subgraph between nodes of subgraph.txt file only but I need to generate a graph between all nodes which are connected to all nodes from subgraph.txt file.


Any help will be appreciated

Regards,
Ashwani


Dan Schult

unread,
Dec 14, 2009, 8:14:24 PM12/14/09
to networkx...@googlegroups.com
Something like this should work...

#set up G
S=nx.Graph()
for n in nbunch:
S.add_edges_from( (n,nbr) for nbr in G[n] )
> --
>
> You received this message because you are subscribed to the Google
> Groups "networkx-discuss" group.
> To post to this group, send email to networkx-
> dis...@googlegroups.com.
> To unsubscribe from this group, send email to networkx-discuss
> +unsub...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/
> group/networkx-discuss?hl=en.

wuyanan2...@gmail.com

unread,
Mar 27, 2016, 8:56:28 AM3/27/16
to networkx-discuss
I have a graph G, I can use list(nx.connected_component_subgraphs(G)) to get connected subgraph g1,g2...
but how can i reverse that progress,that is to say, if i have subgraph g1,g2,.. how can i get the graph G?

在 2009年12月14日星期一 UTC+8下午4:17:25,ashwani sharma写道:

Daniel Schult

unread,
Mar 27, 2016, 5:30:55 PM3/27/16
to networkx...@googlegroups.com
Maybe one of these operators is what you are looking for. 

--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To post to this group, send email to networkx...@googlegroups.com.
Visit this group at https://groups.google.com/group/networkx-discuss.
For more options, visit https://groups.google.com/d/optout.

yanan wu

unread,
Mar 27, 2016, 10:08:09 PM3/27/16
to networkx...@googlegroups.com
thanks very much. I will learn it carefully~

--
You received this message because you are subscribed to a topic in the Google Groups "networkx-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/networkx-discuss/frvVvO6LSJ8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to networkx-discu...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages