【问题标题】:Node shape when using networkx and gexf format使用 networkx 和 gexf 格式时的节点形状
【发布时间】:2013-05-25 23:11:27
【问题描述】:

我正在尝试使用 networkX 自定义图形(用于 gexf 格式)。但我无法设置节点的形状。 使用示例here

import sys
import urllib2
import networkx as nx
data = urllib2.urlopen('http://gexf.net/data/viz.gexf')
G = nx.read_gexf(data)

print G.node['a']

G.node['a']['viz']['position']['x']=10
G.node['a']['viz']['position']['y']=20

# now my addition 
G.node['a']["viz"]['shape'] = 'disc'

print G.node['a'] this seems to work

但我无法写入文件

nx.write_gexf(G,sys.stdout)

错误是:

# AttributeError: 'str' object has no attribute 'get'

我错过了什么吗?

【问题讨论】:

    标签: python networkx gephi


    【解决方案1】:

    这是 GEXF 格式编写器中的一个错误。

    希望现在修复:https://github.com/networkx/networkx/pull/875

    【讨论】:

      猜你喜欢
      • 2012-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-30
      • 2020-08-16
      • 2020-11-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多