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.

Categories

Is there a support for 0-based node labels?

0 votes
Currently when I create a node (by clicking on a canvas), the node is automatically assigned a label, which is 1-based (that is, the first node gets label "1", the second gets label "2" etc). However, the underlying gml graph has an "id" attribute, which is 0-based, that is, the node with label "1" has id "0", the node with label "2" has id "1" etc. This behavior is quite inconvenient, when I use generated gml files with external graph processing libraries.

Would it be possible to add a support for creating either 0-based labels or 1-based ids?

Thanks
in Feature Requests by

1 Answer

0 votes

IDs in GML and GraphML are an implementation detail of the format and in no way related to the text displayed in labels. I.e. these IDs are automatically generated when writing to GML/GraphML and are automatically discarded after reading from GML/GraphML. They are not retained in yEd.
E.g. if you create two nodes with automatic labels "1" and "2", then delete node "1", and finally save the remaining node "2" to GML or GraphML, the GML/GraphML element corresponding to the remaining node will be identifed by '0'. And there are other operations which will have non-obvious effects on the IDs in GML/GraphML files (like e.g. "Raise Selection" or "Lower Selection").

In short, GML and GraphML IDs are not meant to identify elements to the user but only a means for the graph serialization to do its job. Do not try to (mis)use them for anything else.

by [yWorks] (141k points)
edited by
Legal Disclosure | Privacy Policy
...