如何使用PYG和networkx仅显示图的一部分。

huangapple go评论59阅读模式
英文:

How to display only a portion of graph using PYG and networkx

问题

有没有办法只可视化大图的一部分(例如,3万个节点)?
我尝试使用networkx可视化包含1万个节点的图,但由于图中大量节点重叠,无法获得有意义的图像。

g = torch_geometric.utils.to_networkx(data, to_undirected=True)
nx.draw(g, with_labels=True)
英文:

Is there way to visualize only a portion of a large graph (e.g. 30k nodes).
I tried to visualize a graph with 10k nodes using networkx. But it doesn't give a meaningful image due to a large no of overlapping nodes in the image.

g = torch_geometric.utils.to_networkx(data, to_undirected=True)
nx.draw(g, with_labels=True)

答案1

得分: 0

如果您使用nx.draw(g.subgraph([specifed_nodes]), with_labels=True),然后添加plt.show(),您应该能够获得图的部分。希望这有所帮助!

英文:

If you use nx.draw(g.subgraph([specifed_nodes]), with_labels=True) and then add plt.show() you should be able to get only part of the graph networkx documentation - Drawing
. Hope this helps!

huangapple
  • 本文由 发表于 2023年6月13日 15:47:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76462713.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定