我真的是一个编程新手,这就是为什么我的问题可能会很无聊或愚蠢,抱歉!我正在尝试用Gephi(graphml格式)构建合著关系图。一切都很好,但我不明白,如何导入同一个文件中的日期。我的代码如下:
from tethne.readers import wos
MyCorpus = wos.corpus_from_dir(datapath)
from tethne.networks import authors
ca_graph = authors.coauthors(MyCorpus.all_papers())
from tethne.writers import graph
graph.to_graphml(ca_graph, './file.graphml')`
所以,在这个文件.graphml我有作者和机构,但我没有任何年(这部作品出版时)。我找到了一段代码here
MyCorpus.slice('date', 'time_period', window_size=1, cumulative=True)
但我不知道,怎么把所有的东西都写在一个文件里。我将感谢所有的帮助!你知道吗
由于
tethne.writers.graph
使用networkx
图形,您的问题归结为writing attributes to networkx nodes你可以尝试以下方法:
相关问题 更多 >
编程相关推荐