You are correct, the warning originates from the C core and it is harmless. The reason is as follows. <node> tags in GraphML have an id attribute. Users generally expect this attribute to be imported into an igraph vertex attribute, so we do that. However, when the GraphML file is saved, this vertex attribute is also written into the file as an "ordinary" GraphML node attribute (not into the <node> tag but as a separate <data> subtag). We cannot use the "id" vertex attribute directly in the GraphML file as the ids of the <node> tags because the uniqueness of the "id" vertex attribute in igraph is not guaranteed. So, the saved file has both a <node id="..."> identifier for each vertex (used within the file only) and an "id" attribute in a <data> subtag. That's why you get this warning, but as I said, it is harmless. Actually, since it is causing confusion, it might be a good idea to remove it from future releases. Any thoughts?
T. > On 2 Sep 2014, at 10:23, Gianluca Della Vedova <[email protected]> > wrote: > > I can confirm that I have the same warning, but using the C interface. > It seems that it is not a problem, as the file is read correctly. > > Best, > >> On 01/09/2014 22:09, Bradford Boyle wrote: >> When I try to read GraphML files written with python-igraph, I get the >> following `RuntimeWarning`: >> >> RuntimeWarning: Could not add vertex ids, there is already an 'id' >> vertex attribute at foreign-graphml.c:416 >> >> For example, consider the following simple [GraphML file][1]: >> >> <?xml version="1.0" encoding="UTF-8"?> >> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns >> http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"> >> <graph id="G" edgedefault="undirected"> >> <node id="n0"/> >> <node id="n1"/> >> <edge id="e1" source="n0" target="n1"/> >> </graph> >> </graphml> >> >> and a simple python script: >> >> import igraph >> >> G1 = igraph.Graph.Read_GraphML('wiki.graphml') >> G1.write_graphml('wiki-ig.graphml') >> G2 = igraph.Graph.Read_GraphML('wiki-ig.graphml') >> >> which loads the original GraphML files, saves it to a new GraphML file, and >> then tries to read back the just written file. Note the `RuntimeWarning` is >> only generated on the second `Read_GraphML()`. Am I using `write_graphml()` >> and/or `Read_GraphML()` incorrectly? >> >> For reference, I am running Ubuntu 14.04 with python-igraph 0.7 from PyPI. >> >> Thanks, >> >> Bradford >> >> >> [1]: http://en.wikipedia.org/wiki/GraphML#Introduction_to_GraphML >> >> >> >> _______________________________________________ >> igraph-help mailing list >> [email protected] >> https://lists.nongnu.org/mailman/listinfo/igraph-help > > -- > Gianluca Della Vedova > http://gianluca.dellavedova.org > > _______________________________________________ > igraph-help mailing list > [email protected] > https://lists.nongnu.org/mailman/listinfo/igraph-help _______________________________________________ igraph-help mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/igraph-help
