简体   繁体   English

在 pyviz 中可视化二分图

[英]Visualize a bipartite graph in pyviz

I used networkx to visualize a bipartite graph but the result was unsatisfactory (ie nodes, text and edge labels overlapping).我使用networkx 来可视化二分图,但结果并不令人满意(即节点、文本和边缘标签重叠)。 Now I am trying to use the pyviz library ( https://pyviz.org/ ).现在我正在尝试使用 pyviz 库( https://pyviz.org/ )。 The visual problems are now resolved but I can't find a way to separate the right and left side nodes in the outcome graph.视觉问题现在已解决,但我找不到在结果图中分离右侧和左侧节点的方法。 Any suggestions on how can I make a nice looking bipartite graph in pyviz, or any other library?关于如何在 pyviz 或任何其他库中制作漂亮的二部图的任何建议?

Thank you in advance.先感谢您。

Was there some reason the dedicated bipartite layout did not work for you in networkX?是否有某些原因,专用的二分布局在 networkX 中不适合您?

See the example from the documentation below:请参阅以下文档中的示例:

import networkx as nx

G = nx.bipartite.gnmk_random_graph(3, 5, 10, seed=123)
top = nx.bipartite.sets(G)[0]
pos = nx.bipartite_layout(G, top)

nx.draw(G, pos, with_labels=True)

Resulting in the below layout:导致以下布局:

双边布局

Hope this helps.希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM