Here’s my test, after which I need to get back to teaching! Script and graphmls are at https://www.hawaii.edu/filedrop/dl/nqBgt-LmHcN-EpbUI-Wdpvp/ (14 day limit). Conclusion is that id attribute comes in via the igraph/graphml write-read round trip, but the warning comes from the Gephi version.
Making a trivial example
> g1 <- graph_from_literal(A-B)
> summary(g1)
IGRAPH 8fbe2fe UN-- 2 1 --
+ attr: name (v/c)
> write_graph(g1, file="g1.graphml", format="graphml")
The resulting g1.graphml
<?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">
<!-- Created by igraph -->
<key id="v_name" for="node" attr.name="name" attr.type="string"/>
<graph id="G" edgedefault="undirected">
<node id="n0">
<data key="v_name">A</data>
</node>
<node id="n1">
<data key="v_name">B</data>
</node>
<edge source="n0" target="n1">
</edge>
</graph>
</graphml>
Read it back in without saving just to check representation
> read_graph(file="g1.graphml", format="graphml")
IGRAPH c80ee54 UN-- 2 1 --
+ attr: name (v/c), id (v/c)
+ edge from c80ee54 (vertex names):
[1] A--B
So reading it in adds the id attribute that was not there: it is a feature of the igraph graphml write/read round trip but does not trigger the warning.
Now loading this into Gephi and looking in Data Laboratory I get (removing the unused Interval column):
Id Label name
n0 n0 A
n1 n1 B
Although the Id wasn’t replicated, this shows another issue with Gephi-igraph coordination: Gephi uses Label by default for the screen display, so we need to take an extra step to change it to name or copy the name column to Label.
I export this from Gephi as g2.graphml (being sure that layout parameters are not included):
<?xml version="1.0" encoding="UTF-8"?><graphml xmlns="http://graphml.graphdrawing.org/xmlns">
<key attr.name="label" attr.type="string" for="node" id="label"/>
<key attr.name="Edge Label" attr.type="string" for="edge" id="edgelabel"/>
<key attr.name="weight" attr.type="double" for="edge" id="weight"/>
<key attr.name="name" attr.type="string" for="node" id="v_name"/>
<graph edgedefault="undirected">
<node id="n0">
<data key="label">n0</data>
<data key="v_name">A</data>
</node>
<node id="n1">
<data key="label">n1</data>
<data key="v_name">B</data>
</node>
<edge id="2744" source="n0" target="n1">
<data key="weight">1.0</data>
</edge>
</graph>
</graphml>
No problem with id here; the only change is addition of the label. Reading it back into igraph:
> g2 <- read_graph(file="g2.graphml", format="graphml")
> summary(g2)
IGRAPH 881818e UNW- 2 1 --
+ attr: label (v/c), name (v/c), id (v/c), Edge Label (e/c), weight
| (e/n), id (e/c)
There is no warning but we now have label and id attributes on the nodes.
Write the same graph back out and read it again without involving Gephi, we now get the warning:
> write_graph(g2, file="g3.graphml", format="graphml")
> read_graph(file="g3.graphml", format="graphml")
IGRAPH e321c86 UNW- 2 1 --
+ attr: label (v/c), name (v/c), id (v/c), Edge Label (e/c), weight
| (e/n), id (e/c)
+ edge from e321c86 (vertex names):
[1] A--B
Warning message:
In read.graph.graphml(file, ...) :
At vendor/cigraph/src/io/graphml.c:487 : Could not add vertex ids, there is already an 'id' vertex attribute.
Here is g3.graphml
<?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">
<!-- Created by igraph -->
<key id="v_label" for="node" attr.name="label" attr.type="string"/>
<key id="v_name" for="node" attr.name="name" attr.type="string"/>
<key id="v_id" for="node" attr.name="id" attr.type="string"/>
<key id="e_Edge Label" for="edge" attr.name="Edge Label" attr.type="string"/>
<key id="e_weight" for="edge" attr.name="weight" attr.type="double"/>
<key id="e_id" for="edge" attr.name="id" attr.type="string"/>
<graph id="G" edgedefault="undirected">
<node id="n0">
<data key="v_label">n0</data>
<data key="v_name">A</data>
<data key="v_id">n0</data>
</node>
<node id="n1">
<data key="v_label">n1</data>
<data key="v_name">B</data>
<data key="v_id">n1</data>
</node>
<edge source="n0" target="n1">
<data key="e_Edge Label"></data>
<data key="e_weight">1</data>
<data key="e_id">2744</data>
</edge>
</graph>
</graphml>
So now we have both id and v_id. I hope that helps, time to prepare a class!