Reading GML files raises NetworkXError: edge is duplicated

1,735 views
Skip to first unread message

Aika

unread,
Mar 11, 2017, 11:15:40 PM3/11/17
to networkx-discuss
Hi, I noticed that the nx.read_gml( ) function is throwing NetworkXError for some gml files when edge is duplicated. I didn't encounter this error previously for the same command and dataset. I am re-running the code I wrote a year ago using the command

P = nx.read_gml("polblogs.gml")

and I am now encountering the error. I have uploaded the dataset obtained from here for reproducibility. 

Any insight will be greatly appreciated. Thank you.


polblogs.gml

Aric Hagberg

unread,
Mar 11, 2017, 11:35:32 PM3/11/17
to networkx...@googlegroups.com
Hi  - It looks like the code has changed significantly since your previous experience.   I didn't look into the details yet. A workaround for this error is to add "multigraph 1" to the header of the file to reflect that it has multiple edges
graph [
  directed 1
  multigraph 1
  node [
    id 1
...

The previous version of read_gml figured out whether the input file was a graph or multigraph by inspecting all of the edges.

Aric

--
You received this message because you are subscribed to the Google Groups "networkx-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to networkx-discu...@googlegroups.com.
To post to this group, send email to networkx...@googlegroups.com.
Visit this group at https://groups.google.com/group/networkx-discuss.
For more options, visit https://groups.google.com/d/optout.

Aika

unread,
Mar 11, 2017, 11:59:30 PM3/11/17
to networkx-discuss
Thanks so much for the quick response, Aric! I really appreciate it!

Aroua Berriche

unread,
Apr 30, 2019, 5:09:51 AM4/30/19
to networkx-discuss

Capture.PNG

Hi, I have the same problem, I use multiple edges and I have an error message as represented in the figure.
Can you help me, please! Thank you. 
Reply all
Reply to author
Forward
0 new messages