Welcome to yEd Q&A!
Here you can ask questions and receive answers from other members of the community and yEd developers. And you can tell us your most wanted feature requests.

Unique (stable) ID in graphml node elements

+1 vote

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:

  1. 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.
  2. When a file is saved, write the node's UUID to the file as the id attribute in the graphml file.
  3. When a file is loaded, recover (and remember) the id from the file.
  4. 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




asked Mar 20 in Feature Requests by stac (130 points)

Your answer

Email me at this address if my answer is selected or commented on:
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.