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

How to evenly space edge ports across the side of the node they're on?

0 votes

To avoid an XY problem: I found this very nicely laid out graph of a goal factoring, clearly made in yEd, and I desire to layout my own graphs with similar nice visual properties, but I think I've gotten about 90% of the way there and just need one more thing, which is the title of this post. If you happen to know a simpler way of doing all of this, or happen to be the guy who made the graph and remember how you did it, please let me know.

It's laid out in nice vertically aligned tiers of nodes. That's Edit > Align Nodes > Align Vertically.

All the edges have nice 45-degree corners. That's most likely the octilinear routing from Layout > Edge Routing > Orthogonal/Polyline.

All edges start at a port on the bottom side of a node, and end at a port on the top side. That's Side At Source / Side At Target, from Tools > Constraints > Port Constraints.

Lastly, the edge routing appears to be such that, all the necessary edge ports for a node are evenly spaced across the side on which they appear. Expressed slightly differently, you can verify that if you look at the top side of any node in that picture, and divide its width into a number of horizontal segments equal to how many edges are pointing at it, every arrowhead is pointing at the center of one of those segments - because that's where the ports were placed, somehow.

I have not been able to figure out how to do this in yEd, and I find it unlikely that the person who made that graph manually repositioned the arrowheads to approximate equal spacing. It's just too perfect.

Here's how I can get 90% of the way there. Start with this. (I will note that the edges in my graph are of the "Polyline with Target Arrow" edge type, but were placed with View > Orthogonal Edges turned off.)

Select all the nodes
Tools > Constraints > Port Constraints > set Side At Source / Target to Bottom / Top respectively, DON'T check Fix Source / Target Port, Act on Ports at Selected Nodes > OK
Layout > Edge Routing > Orthogonal/Polyline > Scope of Edges at Selected Nodes, Strategy is Balanced, Enable Grid, Enable Rerouting, Enable Octilinear Routing > OK

And I end up with this. So close, but the port spacing is very uneven.

My intuition is that the proper sequence of actions an algorithm would have to take to reproduce the picture up there would be 1) on every node, evenly space the edge ports and fix them in place, then 2) route the edges from source ports to target ports.

(There is one other desirable visual property of the picture in question that might be related to this, which I'd like to understand, which is that the edges appear to have just as many octilinear bends as needed, no more and no less, and they appear to be as long as required. Meanwhile in my own experimentation I can never seem to cause the existence of edges like the one in the top right between "more blog readers" and "have a successful blog", which has just a single S-like bend, or like the long edge from "figure out what I want" to "be able to do whatever I want", which has 4 bends, isn't monotonic, and has varying bend lengths. It seems possible that some amount of this was done manually, but still, the port positions seem too even to be manual.)

in Help by

1 Answer

0 votes
 
Best answer

The layout of the very nicely laid out graph which you found is much easier to create than you think. Simply run the hierarchic layout algorithm with default settings except for "Routing Style" set to "Octilinear" on tab "Edges".

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