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.


Reconstruction of a path

0 votes
Hello to everyone!

I would like to know how I can properly retrieve the coordinates information of an edge, to reconstruct the path connecting two nodes. I saw that in the yEd graphml file of the network I can recognise the source and target ports (sx, sy, tx, ty) and other additional points in the <yPath> tag, which I guess represent the turns/corners of the path (imagine an orthogonal layout). The information related to the source and target ports seem however to be positioned relative to a system having the origin in the centre of the corresponding source/target nodes. Do you think I have correctly understood the structure and meaning of the tag? Thank you in advance!
in Help by

1 Answer

0 votes
Yes, in yEd-generated GraphML files the coordinates of an edge's source and target port are relative to the center of the respective nodes. The coordinates of an edge's bends are absolute coordinates.

A word of caution, though: The GraphML specification does not specify how to store geometry information in GraphML. Thus the way coordinates are stored is an implementation detail of yEd and its edges. (In theory, coordinates could be stored differently for each edge.)
by [yWorks] (158k points)
Thank you Thomas! So you mean that for each edge I could find a different structure other than the one featuring the ports and the bend points?

yEd currently uses the <y:Path> element you already discovered for all its edges / edge styles. In yEd's <y:Path>, source and target port coordinates are relative and bend coordinates are absolute. (Bend coordinates are the <y:Point> child elements in <y:Path>.)

However, if we add a new edge style in the future, you will have to check how that style stores its geometry.

Moreover, other tools store that kind of information in other ways. Even yEd Live uses a different approach. (Indeed, yEd Live does not explicitly store port coordinates but symbolic references to algorithms for computing those coordinates.)

Legal Disclosure | Privacy Policy