Networkx and nx.write_gexf ... Dynamic Node Attributes

1.6k views Asked by At

I am trying to use NetworkX to build a network with dynamic node attributes. I have tried the following:

import networkx as nx    
G=nx.Graph()
G.add_node('A', attr_dict={'data': 1, 'start' : "1990-01-01", 'end' : "1993-01-01"})
G.add_node('B', attr_dict={'data': 2, 'start' : "1992-01-01", 'end' : "1993-01-01"})

However, when writing using nx.write_gexf(G, 'test.gexf') the file loads into Gephi fine but no timeline is showing up.

What is the correct format for entering dynamic node attributes into networkx nodes for writing to gexf file?

1

There are 1 answers

1
Massimo Menichinelli On

Your code is correct, but you need to generate the time interval inside Gephi in the Data Laboratory. See with the network generated with your code:

Merging the columns

Formatting the time

Please note that from version 0.9 onwards Gephi will support timestamps:

This 0.9 release adds a new way to represent networks over time: timestamps. So far, users could only represent time using intervals and that was cumbersome when the underlying network data was collected at fixed time intervals (e.g. one network per day). Starting with this release, Gephi will support both intervals and timestamps to represent evolving network topology and/or evolving attribute values.