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

Hierarchical Layout does not place same node types side-by-side

0 votes

According to help, the hierarchical "node type" establishes when nodes will be placed next to each other. You can establish same node-type either by setting same name, or same color, as explained in here

I do have a network, where some nodes do have same name and color, and nevertheless, the hierarchical layout does not pay attention to that. Have a look:

I was expecting the yellow nodes to be next to each other (same for green ones) but is not happening.

What can I do?

Thanks,

Lucas

in Help by (420 points)

1 Answer

+1 vote

The documentation states that

"Types are used as a subordinate criterion during the sequencing of nodes within their layer."

The hierarchical layout works in several phases.

First, it assigns nodes to layers depending on the structure of the graph. (For layout orientation "top to bottom" this is the top-to-bottom order of the nodes.) Node types are not considered in this step.
Then in the second phase, the algorithm determines the left-to-right order of nodes (again assuming layout orientation "top to bottom") in each layer to minimize the number of edge crossings. This is the step that takes node types into account.

In your example, none of the layers have more than one node of a given type and thus there is nothing to do for the algorithm's node types optimization.

You can try a semi-automated arrangement: after the initial arrangement manually move your "sw" and "rtr" nodes such that they are approximately on the same vertical position. Then run the algorithm once more with option "Use Drawing As Sketch" enabled.

by [yWorks] (160k points)
Thanks for the comment. I tried your suggestion and it indeed worked. But I also found that using Tab_Layers->AssignmentPolicy="BFS Layering" also produces the same result as "Use Drawing as Sketch". The difference is that "BFS Layering" does not need an initial arrangement as "Drawing as Sketch". In any case, both solutions worked. Thank you.
Legal Disclosure | Privacy Policy
...