且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

绘制大量的networkx图:数组太大

更新时间:2023-11-21 14:59:40

问题出在spring_layout方法上.拥有如此多的节点,将需要一些时间来计算所有节点之间的相对位置.对于这么多的节点,我建议您自己弄清楚x,y的位置,或者绘制更小的子图. (< 5000个节点,或者您的计算机在一段时间内可能会变慢.

The problem lies in the spring_layout approach. With this many nodes it will take a while to calculate where all of them should go with respect to one another. With this many nodes I would suggest either figuring out the x,y positions yourself or plot much smaller subgraphs. (<5000 nodes or your computer might be a bit sluggish for a while.

这是erdos_renyi_graph(随机选择的边)中的1000个节点的样子.

Here is what 1000 nodes from an erdos_renyi_graph (randomly chosen edges) looks like.

它拉开了2个节点以突出显示.

It pulled off 2 nodes to highlight.

接下来是1500的样子 它有更多细节.现在有7-8个有趣的节点.

Next is what 1500 looks like It got a little more detail. Now with 7-8 interesting nodes.

在图形上有这么多的边缘和那么多的节点并没有什么好处.如果您不喜欢该输出,该怎么办,您将需要重新运行它.

There isn't much to be gained by so many edges and so many nodes on a graph. And what happens if you don't like the output, you would need to re-run it again.

要获得每个节点的x,y位置,请看一下.在NetworkX中的显示带有节点的图在精确的(x,y)位置.结果旋转

To get x,y positions of each node take a look at this. in NetworkX show graph with nodes at exact (x,y) position. Result is rotated