The following code will create only one window at a time, the second window will only show when the first one is closed by the user.
How to show them at the same time with different titles?
nx.draw_networkx(..a..)
nx.draw_networkx(..b..)
NetworkX has its own drawing module which provides multiple options for plotting. Below we can find the visualization for some of the draw modules in the package. Using any of them is fairly easy, as all you need to do is call the module and pass the G graph variable and the package does the rest.
For NetworkX, a graph with more than 100K nodes may be too large. I'll demonstrate that it can handle a network with 187K nodes in this post, but the centrality calculations were prolonged. Luckily, there are some other packages available to help us with even larger graphs.
Add the nodes from any container (a list, dict, set or even the lines from a file or the nodes from another graph). In addition to strings and integers any hashable Python object (except None) can represent a node, e.g. a customized node object, or even another Graph. Edges: G can also be grown by adding edges.
It works the same as making other plots with Matplotlib. Use the figure() command to switch to a new figure.
import networkx as nx
import matplotlib.pyplot as plt
G=nx.cycle_graph(4)
H=nx.path_graph(4)
plt.figure(1)
nx.draw(G)
plt.figure(2)
nx.draw(H)
plt.show()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With