Edit size of bloc in autoLayout


I use LayeredDigraphLayout and I want to be able to make the size of a specific node as tall as all the others (I have the first image and I want the second)

I tried to see which function that I can override in LayeredDigraphLayout I could not find any that fit for the moment (may I mis some :/)

That’s easy to accomplish with TreeLayout. But not with LayeredDigraphLayout because it is likely to encounter situations with conflicting blocks. Are your graphs always tree-structured?

I can have

I can also have the example in the previous post

function applyLayoutOld() {
  return go.GraphObject.make(go.LayeredDigraphLayout, {
    iterations: 100,
    direction: 0,
    setsPortSpots: true,
    layerSpacing: 150,
    columnSpacing: 10,
    //packOption: go.LayeredDigraphLayout.PackMedian //deprecated see https://gojs.net/latest/api/symbols/LayeredDigraphLayout.html#packOption
    alignOption: go.LayeredDigraphLayout.AlignAll

This is my LayeredDigraphLayout and I am testing with TreeLayout

So your graphs are not tree-structured. You probably won’t like the results from using TreeLayout. But then how do you expect nodes to increase in breadth (height in your case) when there are multiple “parents” for a node? In your second screenshot case, do you want the middle two nodes to overlap each other so that each node matches the extent of the nodes that they connect with? That would be very unusual.

I want him to expand only in the first and second example
The third one will be more unusual

I guess that’s reasonable, but that is more complicated.

I would override the commitNodes method to call the super method and then update the position.y and height of those nodes.

Here’s the code for the much simpler case involving overriding TreeLayout.commitNodes: CoveringTreeLayout

But it’s a lot more complicated in your case because LayeredDigraphLayout handles much more complicated graphs. You’ll have to identify which vertexes/nodes have multiple connections and only have connections with nodes that themselves have no connections with other nodes in the same (original) layer.