Skip to content Skip to sidebar Skip to footer

How To Convert File From Gml To Edgelist In Python?

Is there any example in python, how to convert file from *.gml to *.edgelist? Thank you

Solution 1:

In [1]:  import networkx as nx

In [2]:  g = nx.read_gml('gmlFile.gml')

In [3]:  nx.write_edgelist(g, 'edgelistFile.csv', delimiter=',')

Documentation

read_gml(path, encoding='UTF-8', relabel=False)

write_edgelist(G, path, comments='#', delimiter=' ', data=True, encoding='utf-8')[source]

Post a Comment for "How To Convert File From Gml To Edgelist In Python?"