2015-03-26 21:27 GMT+01:00 Nick Dokos <ndokos@gmail.com>:
Cecil Westerhof <cldwesterhof@gmail.com> writes:

> I was asked to make a diagram and was thinking that dot in org-mode could be a good idea.
>
> I got reasonably fast the following:
> <snip
> This is a good deal in the right direction, but a few things should be different:
> ​- E should be left of F
> - resource should go to the second 'line' without losing its border
> - K should be a 'line' lower
>

Maybe this will help although it's not a complete implementation of
what you have. The idea is to define rows and arrange your nodes into
those rows by using rank=same. Then make the row nodes and edges
invisible. It's also important to do the sequencing correctly, e.g.
in your example, if you just switch F -- E to E -- F, E will be to the
left of F as you want. But I don't know how to get the resources
subgraph to be treated as a node and thereby place it on the same row as F.

In any case, here's the current trial balloon:

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC dot :file test2.svg :cmdline -Kdot -Tsvg
graph foo {
row1--row2--row3--row4 [style="invisible"];
row1, row2, row3, row4 [style="invisible"];

utilities [label = "Utilities"]
 A
 B
 C
 D
 E
 F [shape="rectangle"]
 G
 H
 I
 K
 subgraph cluster_ta {
 color=blue
 {rank = same; L, M;}
 L
 M
 }

{rank=same; row1 utilities A B C; }
{rank=same; row2 D E F;}
{rank=same; row3 G H I;}
{rank=same; row4 K;}

subgraph cluster_resources {
  resources [label = "Resources"]
  graph[color=red];
 }

A -- F
B -- F
C -- F
A -- D
E -- F
F -- G
F -- H
F -- I
F -- K
K -- L
K -- M
L -- M
}
#+END_SRC

--8<---------------cut here---------------end--------------->8---

​I did it a little differently:
    #+BEGIN_SRC dot :file test.png :cmdline -Kdot -Tpng
    graph {
      utilities [label = "Utility's"]
   
      A
      B
      C
   
      D
      E
      F [shape = rectangle]
   
   
      subgraph cluster_resources {
        color=blue
        resources [label = "Resources"]
      }
   
      G
      G_ [style="invisible"]
      H
      I
   
      K
      subgraph cluster_ta {
        color=blue
        {rank = same; L, M}
        L
        M
      }
   
      {rank = same; D,  E, F}
      {rank = same; G_, K}
   
   
      A -- F
      B -- F
      C -- F
      A -- D
   
      E -- F
   
      F -- K
      F -- G
      F -- H
      F -- I
   
      G -- G_ [style="invisible"]
   
      K -- L
      K -- M
      L -- M
    }
    #+END_SRC
 
​In this way I do not get an empty column. It would be better when K would put between and below H and I, but I think I can live with it.​

--
Cecil Westerhof