--------- Mensagem encaminhada --------- De: RAFAEL SERAPILHA DURELLI rafael.durelli@ufla.br Data: seg., 21 de fev. de 2022 às 11:35 Assunto: Re: [graph-tool] Adding label to vertices Para: Alexandre Hannud Abdo abdo@member.fsf.org
Ok, I managed to use the data/key nodes.
Thanks a lot.
However, how can I access them after loading the grapheme file?
See the graphml example:
<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"> <key id="d0" for="node" attr.name="label" attr.type="string"></key> <key id="d1" for="edge" attr.name="weight" attr.type="double"/> <graph id="G" edgedefault="directed"> <node id="US10095832B2"> <data key="d0">"US10095832B2"</data> </node> <edge source="US10095832B2" target="US20180002751A1"> <data key="d1">15</data> </edge> </graph> </graphml>
How can I access the 15 and the label ?
Thanks a lot
On 21 Feb 2022, at 11:01, Alexandre Hannud Abdo abdo@member.fsf.org wrote:
Ni! Hi Rafael, In graphml, ids are not graph data. If your source uses node ids for data you should fix it and use <key>/<data> instead (see 'Additional Data' in http://graphml.graphdrawing.org/specification.html http://graphml.graphdrawing.org/specification.html). Node ids are for internal parsing use and are not guaranteed to be preserved.
Once your source produces labels as specified by the graphml format, in the graph-tool loaded Graph that data will be available as internal property maps:
https://graph-tool.skewed.de/static/doc/quickstart.html#internal-property-ma...
Hope this helps,
ale
.~´ Le 21/02/2022 à 10:00, RAFAEL SERAPILHA DURELLI a écrit :
Hello, guys
I have been learning graph-tool.. I would like to know if it is possible to create/load vertices and edges with labels. Im loading a graphml file, and in this file the node id = A, B ,C etc. However, when the loading is done, all vertex are transformed into numbers. I would like to know if is it possible to preservate the vertex name, such as A, B, C, "anyStrings", etc.
Thanks in advance
Dear Rafael,
In graphml, ids are not graph data. If your source uses node ids for data you should fix it and use <key>/<data> instead (see 'Additional Data' in http://graphml.graphdrawing.org/specification.html http://graphml.graphdrawing.org/specification.html). Node ids are for internal parsing use and are not guaranteed to be preserved.
This is not quite right. If the node/edge ids are not in the canonical format, they are imported as property maps when the graph is loaded.
The property maps can be accessed as:
g.vp["_graphml_vertex_id"]
and
g.ep["_graphml_edge_id"]
Best, Tiago
Ni! You'd access them as internal property maps, in your case:
g.vp["label"] and g.ep["weight"]
But as Tiago pointed out, graph-tool does preserve the ids as property maps in case you used them to store graph data.
The advantage of using the proper format is that it will work the same with any software, that it will work for non-unique properties, that you can store multiple properties, and also declare their types.
Best,
ale
.~´
Le 21/02/2022 à 12:16, RAFAEL SERAPILHA DURELLI a écrit :
--------- Mensagem encaminhada --------- De: *RAFAEL SERAPILHA DURELLI* rafael.durelli@ufla.br Data: seg., 21 de fev. de 2022 às 11:35 Assunto: Re: [graph-tool] Adding label to vertices Para: Alexandre Hannud Abdo abdo@member.fsf.org
Ok, I managed to use the data/key nodes.
Thanks a lot.
However, how can I access them after loading the grapheme file?
See the graphml example:
<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"> <key id="d0" for="node" attr.name http://attr.name="label" attr.type="string"></key> <key id="d1" for="edge" attr.name http://attr.name="weight" attr.type="double"/> <graph id="G" edgedefault="directed"> <node id="US10095832B2"> <data key="d0">"US10095832B2"</data> </node> <edge source="US10095832B2" target="US20180002751A1"> <data key="d1">15</data> </edge> </graph> </graphml>
How can I access the 15 and the label ?
Thanks a lot
On 21 Feb 2022, at 11:01, Alexandre Hannud Abdo abdo@member.fsf.org wrote:
Ni! Hi Rafael,
In graphml, ids are not graph data. If your source uses node ids for data you should fix it and use <key>/<data> instead (see 'Additional Data' in http://graphml.graphdrawing.org/specification.html http://graphml.graphdrawing.org/specification.html). Node ids are for internal parsing use and are not guaranteed to be preserved.
Once your source produces labels as specified by the graphml format, in the graph-tool loaded Graph that data will be available as internal property maps:
https://graph-tool.skewed.de/static/doc/quickstart.html#internal-property-ma...
Hope this helps,
ale
.~´
Le 21/02/2022 à 10:00, RAFAEL SERAPILHA DURELLI a écrit :
Hello, guys
I have been learning graph-tool.. I would like to know if it is possible to create/load vertices and edges with labels. Im loading a graphml file, and in this file the node id = A, B ,C etc. However, when the loading is done, all vertex are transformed into numbers. I would like to know if is it possible to preservate the vertex name, such as A, B, C, "anyStrings", etc.
Thanks in advance
--
At.te Prof. Dr. Rafael S. Durelli.
O conteúdo deste e-mail e anexos são restritos aos seus destinatários e de responsabilidade do remetente. O uso do e-mail deve estar de acordo com os regulamentos institucionais vigentes.
graph-tool mailing list --graph-tool@skewed.de To unsubscribe send an email tograph-tool-leave@skewed.de
--
At.te Prof. Dr. Rafael S. Durelli.
O conteúdo deste e-mail e anexos são restritos aos seus destinatários e de responsabilidade do remetente. O uso do e-mail deve estar de acordo com os regulamentos institucionais vigentes.
graph-tool mailing list --graph-tool@skewed.de To unsubscribe send an email tograph-tool-leave@skewed.de