我试图在 pygraph 中使用超图来解决问题,以下是我插入的一个简单示例:
hgr = hypergraph()
hgr.add_nodes(["A1", "B1", "C1", "D1"])
hgr.add_nodes(["A2", "B2", "C2", "D2"])
hgr.add_nodes(["A3", "B3", "C3", "D3"])
hgr.add_nodes(["A4", "B4", "C4", "D4"])
hgr.add_hyperedge(("A1", "A2", "A3", "A4"))
hgr.add_hyperedge(("B1", "B2", "B3", "B4"))
hgr.add_hyperedge(("C1", "C2", "C3", "C4"))
hgr.add_hyperedge(("D1", "D2", "D3", "D4"))
h_dot = write(hgr)
h_gvv = gv.readstring(h_dot)
gv.layout(h_gvv,'dot')
gv.render(h_gvv, 'png', 'hypergraph.png')
请验证这是使用 pygraph 创建超图的正确方法。
非常感激!