How to move non-clustered nodes in max rank

Hi all,

I wonder if it is possible to make this graph somewhat more compact by moving the non-clustered nodes below the clusters. I tried multiple options but nothing seems to work.

Thanks in advance for the help!

// generated using net2dot
graph {
  node [fontsize=11 fontname=monospace margin=0];
  graph [compound=true style=dotted];

  _lo [color=peru shape=invtriangle label=<<b>lo</b><br/><font color="peru">loopback</font>>];
  _enp1s0 [color=gray shape=oval label=<<b>enp1s0</b><br/><font color="gray">virtio_net</font><br/><font color="gray">bus 0000:01:00.0</font><br/><font color="navy">192.168.122.233/24</font>>];
  _br_phy [color=gray shape=diamond label=<<b>br-phy</b><br/><font color="gray">bridge</font>>];
  _p1 [color=red shape=hexagon label=<<b>p1</b><br/><font color="red">veth</font>>];
  _p2 [color=red shape=hexagon label=<<b>p2</b><br/><font color="red">veth</font>>];
  _bond0 [color=deeppink shape=house label=<<b>bond0</b><br/><font color="deeppink">bond</font><br/><font color="deeppink">mode balance-rr</font><br/><font color="deeppink">lacp slow</font>>];
  _prout0 [color=gray shape=oval label=<<b>prout0</b><br/><font color="gray">dummy</font>>];
  _prout1 [color=gray shape=oval label=<<b>prout1</b><br/><font color="gray">dummy</font>>];
  _veth0 [color=red shape=hexagon label=<<b>veth0</b><br/><font color="red">veth</font>>];
  _foo [color=red shape=hexagon label=<<b>foo</b><br/><font color="red">veth</font>>];

  subgraph compute1 {
    label="netns compute1";
    cluster=true;

    compute1_lo [color=peru shape=invtriangle label=<<b>lo</b><br/><font color="peru">loopback</font>>];
    compute1_tenant [color=green shape=oval label=<<b>tenant</b><br/><font color="green">vlan</font><br/><font color="green">id 200</font>>];
    compute1_phy [color=red shape=hexagon label=<<b>phy</b><br/><font color="red">veth</font>>];
    compute1_br_tenant [color=gray shape=diamond label=<<b>br-tenant</b><br/><font color="gray">bridge</font>>];
    compute1_vm3 [color=gray shape=oval label=<<b>vm3</b><br/><font color="gray">dummy</font><br/><font color="navy">192.168.1.3/24</font>>];
    compute1_vm4 [color=gray shape=oval label=<<b>vm4</b><br/><font color="gray">dummy</font><br/><font color="navy">192.168.1.4/24</font>>];
    compute1_vxlan0 [color=blue shape=oval label=<<b>vxlan0</b><br/><font color="blue">vxlan</font><br/><font color="blue">id 1234</font><br/><font color="blue">local 172.16.2.1</font><br/><font color="blue">group 239.0.0.1</font>>];
  }

  subgraph compute2 {
    label="netns compute2";
    cluster=true;

    compute2_lo [color=peru shape=invtriangle label=<<b>lo</b><br/><font color="peru">loopback</font>>];
    compute2_tenant [color=green shape=oval label=<<b>tenant</b><br/><font color="green">vlan</font><br/><font color="green">id 200</font>>];
    compute2_vxlan0 [color=blue shape=oval label=<<b>vxlan0</b><br/><font color="blue">vxlan</font><br/><font color="blue">id 1234</font><br/><font color="blue">local 172.16.2.2</font><br/><font color="blue">group 239.0.0.1</font>>];
    compute2_br_tenant [color=gray shape=diamond label=<<b>br-tenant</b><br/><font color="gray">bridge</font>>];
    compute2_phy [color=red shape=hexagon label=<<b>phy</b><br/><font color="red">veth</font>>];
    compute2_vm1 [color=gray shape=oval label=<<b>vm1</b><br/><font color="gray">dummy</font><br/><font color="navy">192.168.1.1/24</font>>];
    compute2_vm2 [color=gray shape=oval label=<<b>vm2</b><br/><font color="gray">dummy</font><br/><font color="navy">192.168.1.2/24</font>>];
  }

  _p1 -- _br_phy;
  _p1 -- compute1_phy [style=dashed];
  _p2 -- _br_phy;
  _p2 -- compute2_phy [style=dashed];
  _prout0 -- _bond0;
  _prout1 -- _bond0;
  _veth0 -- _foo [style=dashed];
  _foo -- _veth0 [style=dashed];
  compute1_tenant -- compute1_phy [style=dashed];
  compute1_phy -- _p1 [style=dashed];
  compute1_vm3 -- compute1_br_tenant;
  compute1_vm4 -- compute1_br_tenant;
  compute1_vxlan0 -- compute1_br_tenant;
  compute1_vxlan0 -- compute1_tenant [style=dashed];
  compute2_tenant -- compute2_phy [style=dashed];
  compute2_vxlan0 -- compute2_br_tenant;
  compute2_vxlan0 -- compute2_tenant [style=dashed];
  compute2_phy -- _p2 [style=dashed];
  compute2_vm1 -- compute2_br_tenant;
  compute2_vm2 -- compute2_br_tenant;
}

HoOL

The title of your request even provides the answer. Add the following to the bottom of the file:

 {rank=sink _foo _bond0 _lo  _enp1s0 }  // or rank=max

Giving:

Can’t believe after all these years this was a useful feature, since it was only implemented out of a compulsive sense of completism.