igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] GraphML RuntimeWarning


From: Gianluca Della Vedova
Subject: Re: [igraph] GraphML RuntimeWarning
Date: Wed, 03 Sep 2014 10:50:33 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0

IMHO, as long as the two ids are the same, there is no need for a warning.

For instance, let consider the following snipped of graphml file.
<node id="n0">
      <data key="v_id">0</data>
      <data key="v_color">0</data>
    </node>

The <node> and the <data> ids are both 0, so it is ok to have an igraph
node with id=0. I would like a warning (or maybe an error) if the ids
are different as in:
<node id="n0">
      <data key="v_id">1</data>
      <data key="v_color">0</data>
    </node>

Best,

On 02/09/2014 10:57, Tamás Nepusz wrote:
> 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
>> <address@hidden> 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 address@hidden 
>>> https://lists.nongnu.org/mailman/listinfo/igraph-help
>> 
>> -- Gianluca Della Vedova http://gianluca.dellavedova.org
>> 
>> _______________________________________________ igraph-help mailing
>> list address@hidden 
>> https://lists.nongnu.org/mailman/listinfo/igraph-help
> 
> _______________________________________________ igraph-help mailing
> list address@hidden 
> https://lists.nongnu.org/mailman/listinfo/igraph-help
> 

-- 
Gianluca Della Vedova
http://gianluca.dellavedova.org



reply via email to

[Prev in Thread] Current Thread [Next in Thread]