1

I'm really new in programming, that's why my question can be probably boring or stupid, sorry for this! I'm trying to build co-authorship graph in Gephi (graphml format). Everything is fine, but I don't understand, how to import dates in the same file. My code is following:

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')`

So, in this file.graphml I have authors and institutions, but I don't have any years (when this work was published). I have found a piece of code here

MyCorpus.slice('date', 'time_period', window_size=1, cumulative=True)

but I have no idea, how to write everything in one file. I will appreciate all the help!

Yannis P.
  • 2,745
  • 1
  • 24
  • 39
koptyaevas
  • 45
  • 5

1 Answers1

1

Since tethne.writers.graph uses networkx graphs your problem boils down to writing attributes to networkx nodes

You could try something like:

for author, attribs in ca_graph:
    # somehow calculate a year_value
    ca_graph.node[author]['year'] = year_value
Yannis P.
  • 2,745
  • 1
  • 24
  • 39