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

Layout with straight edges and no edge-node overlaps?

0 votes
Hello, I have hopefully a quite simple question.

I want the program to rearrange a graph into a new layout that has only two features:

1) All edges are straight lines.

2) Nodes do not overlap with each other, or with edges. (Edges can overlap with other edges.)

Is there any way to do this? I've tried seemingly every layout offered, but all of them either have curved edges (e.g. tree layout) or overlapping edges/nodes (e.g. organic layout).

Thanks!
in Help by (120 points)

1 Answer

0 votes
Your best bet is indeed the organic layout algorithm. I suggest to give organic a second chance. Be sure to enable option "Avoid Node/Edge Overlaps" on tab "Visual" and to set option "Quality/Time Ratio" on tab "Algorithm" to "1.0". Moreover, I recommend increasing the "Preferred Edge Length". You probably need to play around with different length values here.
by [yWorks] (160k points)
Thanks you so much for the prompt answer. However, I have not been able to get the organic layout to really 'obey' the "avoid node/edge overlap" option.

To demonstrate, I made this diagram:

https://imgur.com/a/7AWgKNR

As you can see, it is certainly possible to position the nodes such that they do not overlap with anything.

However, when I order an organic layout (preferred edge length = 500; minimal node distance = 0; avoid node/edge overlaps = yes; compactness = 0; use natural clustering = no; quality/time ratio = 1; maximal duration = 600 seconds; all substructures = ignore), I get this:

https://imgur.com/a/euzzESC

That said, if I uncheck the "avoid node/edge overlap" option, the result is far worse:

https://imgur.com/a/V8XDzsh

So it appears as though the program is attempting to follow the "avoid node/edge overlap" instructions, but not trying all that hard. While, in this example, that only results in one edge cutting across one node's corner, it's much more problematic in my actual, far more complex, diagram.

There isn't, by any chance, a way to tell the program to really prioritize the "avoid overlap" instruction as a rule rather than a suggestion, is there?

Thanks again!
Unfortunately, the organic layout algorithm is able to guarantee a completely overlap free result.

The likelihood for overlaps increases with the complexity of the diagram but not necessarily with its element count. I.e. in your sample diagrams, all of your nodes are highly interconnected. Such a diagram is called "dense". Unfortunately, there usually is no "good" arrangement for dense diagrams at all. (From an algorithmic point of view, your manually adjusted solution is only marginally better than the automatic solution since you only removed one node-edge crossing.) So, if your element count increase but the density drops, you may actually get better results for "larger" diagrams.
Legal Disclosure | Privacy Policy
...