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

Specify node y-coordinates, layout x-coordinates and edges

0 votes
I want to specify the y-coordinates of each of my nodes, and have yEd layout the x-coorinates and place the edges appropriately.

Is this possible in yEd?

And if so, then what GraphML code would I need to specify the y-coordinates? (I'm using a script to generate a huge graph from my data, so can't type them all in by hand.)

I've noticed swimlane layouts, but these don't seem to be quite what I'm wanting.

Thanks for your help, and thanks for the great software
in Help by

1 Answer

0 votes

There is no layout algorithm that will exactly do that, however, the Hierarchical layout can be configured to keep the relative order in y-direction. To do that, choose "From Sketch" as "Layer Assignment Policy" on tab "Layers".

To specify coordinates for nodes in GraphML, you have to define nodegraphics data:

<graphml
 xmlns="http://graphml.graphdrawing.org/xmlns"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xmlns:y="http://www.yworks.com/xml/graphml"
 xmlns:yed="http://www.yworks.com/xml/yed/3"
 xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd">
  <key for="node" id="d0" yfiles.type="nodegraphics"/>
  <graph edgedefault="directed" id="G">
    <node id="n0">
      <data key="d0">
        <y:ShapeNode>
          <y:Geometry height="30.0" width="30.0" x="0.0" y="0.0"/>
        </y:ShapeNode>
      </data>

    </node>

    ...
  </graph>
</graphml>

by [yWorks] (144k points)
Thank you very much for the quick reply - this is really good.

Thank you also for the code sample - that helped a lot.

As you said, it is changing the y-coordinates, but it is keeping the relative order - and it seems to be keeping the relative distances as well, which is what I wanted.
It would be better if it were possible to fix the y-coordinates precisely, but the relative version is still good.
Legal Disclosure | Privacy Policy
...