Improper quotation encoding in GML files, and other deviations from the spec
graph-tool's GML writer deviates from the GML spec in several ways, which prevents other software from reading files created by graph-tool. You can download the "technical report" containing the spec here:
https://web.archive.org/web/20190207140002/http://www.fim.uni-passau.de/index.php?id=17297%26L=1
The most problematic behaviour is the escaping of strings. graph-tool uses backslash escaping, but GML requires using quot;
instead. IPython transcript of an example:
In [1]: from graph_tool.all import *
Installed osx event loop hook.
In [2]: g = Graph()
In [3]: g.graph_properties['foo'] = g.new_graph_property('string', 'one "two" three')
In [4]: g.save('test.gml')
This results in:
graph [
directed 1
foo "one \"two\" three"
]
This file won't be read by any of igraph, NetworkX, yEd.
Other issues are visible in the GML version of this graph:
https://networks.skewed.de/net/ceo_club
Namely:
- Property names are not allowed to contain underscores. Both NetworkX and yEd choke on this.
- It is unclear if strings are allowed to contain newlines. NetworkX chokes on this.
igraph doesn't mind either of these two issues. I was the last person to work on igraph's GML reader and my philosophy was to be as lenient during parsing as feasible. So underscores and newlines are no problem. However, interpreting the backslash as an escape character directly conflicts with how other software interprets GML strings, so I decided not to let igraph's parser handle this.