[Networkit] Error for GMLReader

Maximilian Vogel maximilian.vogel at student.kit.edu
Tue Nov 17 21:43:29 CET 2015

According to the format specification[1], it is an invalid file for two 
- The file you attached starts with "Creator ...". It is nowhere stated 
that a comment is allowed outside the "graph ["-tag and even then it has 
to be identified through the line starting with "comment".
- The graph reader expects the lines to be formed like this: "graph [\n 
<more tags> \n]". The opening bracket is supposed to be on the same line 
as the graph, node or edge tag. In the file it is differently formatted: 
"graph\n [\n".

However, the graph reader could be adapted to recover from both issues, 
but I can't estimate precisely how much work it'll be.


On 17.11.2015 21:23, Christian Staudt wrote:
> I get this error when trying to read a GML file (attached). As always, the questions are: a) Is this a bug in the reader? b) Is this an invalid GML file? c) If b, should the reader behave in a strict or resilient way?
> ---------------------------------------------------------------------------
> RuntimeError                              Traceback (most recent call last)
> /Users/cls/workspace/NetworKit/networkit/graphio.py in readGraph(path, fileformat, **kwargs)
>      129                         try:
> --> 130                                 G = reader.read(path)
>      131                                 G.setName(os.path.basename(path).split(".")[0]) # set name of graph to name of file
> _NetworKit.pyx in _NetworKit.GraphReader.read (networkit/_NetworKit.cpp:26034)()
> RuntimeError: graph key not found
> During handling of the above exception, another exception occurred:
> OSError                                   Traceback (most recent call last)
> <ipython-input-11-7962747ba933> in <module>()
> ----> 1 G = readGraph("/Users/cls/Downloads/dolphins/dolphins.gml", Format.GML)
>        2 G.indexEdges()
> /Users/cls/workspace/NetworKit/networkit/graphio.py in readGraph(path, fileformat, **kwargs)
>      132                                 return G
>      133                         except Exception as e:
> --> 134                                 raise IOError("{0} is not a valid {1} file: {2}".format(path,fileformat,e))
>      135         return None
>      136
> OSError: /Users/cls/Downloads/dolphins/dolphins.gml is not a valid Format.GML file: graph key not found
> Best,
> Chris
> _______________________________________________
> NetworKit mailing list
> NetworKit at ira.uni-karlsruhe.de
> https://lists.ira.uni-karlsruhe.de/mailman/listinfo/networkit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ira.uni-karlsruhe.de/mailman/private/networkit/attachments/20151117/16cac660/attachment.html>

More information about the NetworKit mailing list