我正在尝试导出一个带有一些可视化规范的图形文件。我不知道如何添加多级属性。在
Import networkx as nx
#Create the Graph
g = nx.Graph()
g.add_edge('Andre', 'Beverly')
g.add_edge('Andre', 'Diane')
g.add_edge('Andre', 'Carol')
g.add_edge('Andre', 'Fernando')
g.add_edge('Beverly', 'Diane')
nx.draw(g)
我想用一个特定的结构来添加名称和属性
^{pr2}$事实上,我有两个问题:
信息:我真正想要的是一种将网络图导出到gexf文件中的方法,我可以用gexf-js打开这个文件,而不用经过gephi.
附言:我有this question 和其他与此相关的内容,但据我所知,它们并不涉及我所追求的。在
计算
spring_layout()
中的位置后:结果:
^{pr2}$然后你可以让
nx.write_gexf(g, 'somefile.gexf')
工作:-)相关问题 更多 >
编程相关推荐