user3665906
user3665906

Reputation: 195

Networkx visualization

I am new to netwrokx and I have a big network as follows that I need to just visualize its blue nodes:

enter image description here

Is there any way to see just blue nodes while the distance between them is same as the real graph's? My desired output would be something like following one: enter image description here

Result of using pos layout is as follows: enter image description here

Joel helped med to find out the result and I share codes and outcome here for those who have the similar question:

Answer Codes:

pos = nx.spring_layout(G) 
nx.draw_networkx(G, pos, nodelist = blue_nodes, node_color = 
'blue',with_labels=False)

outcome: enter image description here

Upvotes: 0

Views: 300

Answers (1)

Joel
Joel

Reputation: 23887

Given a network G, with a list of "blue" nodes bluenodes, we can define a set of positions, and then draw just the blue nodes.

pos = nx.spring_layout(G) #there are other layouts that you might want to try.
nx.draw_networkx_nodes(G, pos, nodelist = bluenodes, node_color = 'blue', with_labels=False)

Upvotes: 2

Related Questions