I want to use networkx in python to read a .gml file.
However when I do,
import networkx as nx
nx.read_gml("myfilename.gml")
it raises the error
networkx.exception.NetworkXError: edge #213 (103->400) is duplicated
which is true that in the .gml file there are duplicate edges.
Is there any way to read a .gml file with duplicate edges without raising an error?
You should simply add "multigraph 1" to the file header, which allows the graph to have multiple edges and will result in
nx.read_gml
returning aMultiDiGraph
.Already, the full error trace should already give you this answer
taken from
parse_gml_lines
, if you are using the latestnetworkx
version.