graphml <edge> inside <node>


Laura Morales
 

Sorry I'm asking to this list because I can't find this information anywhere else.
Is it possible to have an <edge> element nested inside a <node> element with graphml? And will Janus be able to read it correctly? Basically, instead of

<node id="1"></node>
<node id="2"></node>
<edge source="1" target="2"></edge>

I would like to use

<node id="1">
<edge target="2"></edge>
</node>
<node id="2"></node>

This would be very useful to me because I have a file (in graphml format) that I'm editing manually, and nesting edges will help me keep all the information "bundled" within a <node>; it would also reduce the verbosity by a lot. Unfortunately I have a feeling that this is not defined by the graphml spec, but I wonder if Janus can parse it?


hadoopmarc@...
 

Hi Laura,

Your assumption about ordering of nodes and edges is correct, see the warning at: https://tinkerpop.apache.org/docs/current/reference/#graphml

For your use case it seems that you can simply edit the nodes and edges out of order and now and then save an ordered version of the graph using the sort function of your editor. If you do a lot of editing, it is probably more convenient to write a custom csv import script for networkx and then save as graphml.

Best wishes,    Marc