You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to networkx-discuss
I have created a function that allows me to search my network for a node that returns and creates a network comprised of that given node's connections. My only issue is that my subgraphs are made through G.neighbors so all my edges are lost and I only have a disconnected network. Does anyone know how to create subgraphs from a main graph that produces all connected nodes for a given node? My network is rather large so I cannot manually make these connections in the subgraph but instead maintain the relationships from my main network.
Thanks!
Dan Schult
unread,
May 2, 2022, 12:53:47 PM5/2/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to networkx...@googlegroups.com
Does `Gsub = G.subgraph(nodes_I_want_to_include)` work?
So for example: `Gsub = G.subgraph(G.neighbors(node))`
There is also a function called `nx.ego_graph(G, node)` which does this sort of thing.
Matthew Kline
unread,
May 10, 2022, 9:16:07 AM5/10/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to networkx-discuss
Thank you so much for your reply. The ego graph was perfect because it maintained edge relationships. Do you know if there is a way to center a specific node in an ego graph? I want to visually show which node the graph is showing the relationships for. Thanks again!
Dan Schult
unread,
May 10, 2022, 9:41:29 AM5/10/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to networkx...@googlegroups.com
I have used the `shell_layout` function for visualizing ego graphs.
Matthew Kline
unread,
May 10, 2022, 1:56:21 PM5/10/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to networkx-discuss
I tried using the shell layout and it produced the same output as the circular layout that I was using before. Is there a way to use either of those layouts to specify a node to be physically in the middle like a hub? Thanks again!
I attached a google image to show what I am trying to make it look like.