From other answers on this site [1][2], I understand that the id attribute in the graphml node elements are auto-generated on saving. This clearly satisfies the uniqueness property required by graphml but makes comparing (the structure of) different versions of a graphml file more difficult since node ids change as the graph is edited.
I also understand that it is possible to add additional custom properties and to manually edit those properties as the graph is edited. This method can be used to provide a stable identifier for a given node but maintaining the uniqueness within the graph is a very manual and error-prone process. e.g. copying a node always requires a manual edit of the new node to prevent duplicate IDs.
I would like to request a slightly different behaviour for the allocation of the id in the saved files:
-
As each node is created (as new or as a copy), generate a version 4 (random) UUID [3] to be used as the id attribute for that node.
-
When a file is saved, write the node's UUID to the file as the id attribute in the graphml file.
-
When a file is loaded, recover (and remember) the id from the file.
-
On subsequent saves, preserve the id value.
This would provide a unique identifier that was stable across edits to a graph.
This algorithm would also appear to solve one of your other feature requests [4].
Thanks for providing such a useful graph drawing tool, and thanks for taking the time to consider this request.
[1] http://yed.yworks.com/support/qa/10104/change-node-key-from-int-to-a-user-selected-string
[2] http://yed.yworks.com/support/qa/812/imported-node-and-edge-ids-are-overwritten
[3] https://tools.ietf.org/html/rfc4122#section-4.4
[4] http://yed.yworks.com/support/qa/812/imported-node-and-edge-ids-are-overwritten