Rank between cluster

Hi,

i use dot to draw a structure for my program. i want "loader module" cluster more closer in vertical. 

digraph infterface  {
labelloc = true;
node [shape="record", color="skyblue"];
edge [style="dashed", color="gray"];

subgraph cluster_core {
    label   = "Core Module";
    color   = "gray";
    bgcolor = "oldlace";
    core [label="{core module|<f1>f1|<f2>f2|<f3>f3|<f4>f4|<f5>f5|<f6>f6}"];
}

subgraph cluster_fsys {
    label   = "Fsys Module";
    color   = "gray";
    bgcolor = "mintcream";
    fsys [label="{fsys module|<f1>f1|<f2>f2|<f3>f3|<f4>f4|<f5>f5|<f6>f6}"];
}

subgraph cluster_loader {
    label   = "Loader Module";
    color   = "gray";
    bgcolor = "mintcream"    
    loader1 [label="{loader1|<f1>f1}"];
    loader2 [label="{loader2|<f1>f2}"];
    loader3 [label="{loader3|<f1>f3}"];
}

loader1->loader2->loader3;
//{rank=same core fsys loader2}
}

any sugguestion is welcome. sorry for my poor English.

Regards.

AttachmentSize
cluster.png23.82 KB
cluster1.png23.02 KB
cluster2.png23.24 KB

The alignment in Graphviz is

The alignment in Graphviz is usually done using nodes and edges. In this case, the nodes in the first two clusters and the top node in the last cluster all lie on the same rank, based on the center of the nodes. (A possible feature would be a vertical alignment for nodes, but that doesn't exist at present.) You can get what you want but it will take a little effort. One way is to replace the cluster labels with real nodes with shape=none and an invisible from it to the current top node in each cluster. Alternatively, you can split the graph into components, lay out each separately, then pack them the way you want:

  ccomps -x cluster.gv | dot | gvpack -array_t3 | neato -n2 -Tpng > cluster.png

One warning: while checking your example, I found a bug in gvpack, so you would need to install tomorrow's working version.

thanks for reply

i tried your first suggestion, replace the cluster labels with real nodes with shape=none, and an invisible from it to the top node in each cluster. it doesn't work for me. the second node in each cluster are lie on the same rank as before.

split graph into components will be a good idea. can i add relationship between components? because i need this this between nodes in different cluster, 

thank you very much for helping me. best regards.

 

digraph infterface  {
//labelloc = true;
node [shape="record", color="skyblue"];
edge [style="dashed", color="gray"];

subgraph cluster_core {
    color   = "gray";
    bgcolor = "oldlace";
    core_label[label="Core Module" shape=none];
    core [label="{core module|<f1>f1|<f2>f2|<f3>f3|<f4>f4|<f5>f5|<f6>f6}"];
    core_label -> core [style=invis];
}

subgraph cluster_fsys {
    color   = "gray";
    bgcolor = "mintcream";
    fsys_label [label="Fsys Module" shape=none];
    fsys [label="{fsys module|<f1>f1|<f2>f2|<f3>f3|<f4>f4|<f5>f5|<f6>f6}"];
    fsys_label -> fsys [style=invis];
}

subgraph cluster_loader {
    color   = "gray";
    bgcolor = "mintcream";
    loader_label [label="Loader Module" shape=none];
    loader1 [label="{loader1|<f1>f1}"];
    loader2 [label="{loader2|<f1>f2}"];
    loader3 [label="{loader3|<f1>f3}"];
    loader_label -> loader1 [style=invis];
}

loader1 -> loader2 -> loader3;
//{rank=same core fsys loader2}
}

i tried your suggestion One.

i tried your suggestion One. replace the cluster labels with readl nodes with shape=none, it doesn't work for me.

i'll need to add relationship between node in different cluster, can i do this betwwen components?

thank you very much for helping me. best regards.

 

digraph infterface  {
//labelloc = true;
node [shape="record", color="skyblue"];
edge [style="dashed", color="gray"];

subgraph cluster_core {
    color   = "gray";
    bgcolor = "oldlace";
    core_label[label="Core Module" shape=none];
    core [label="{core module|<f1>f1|<f2>f2|<f3>f3|<f4>f4|<f5>f5|<f6>f6}"];
    core_label -> core [style=invis];
}

subgraph cluster_fsys {
    color   = "gray";
    bgcolor = "mintcream";
    fsys_label [label="Fsys Module" shape=none];
    fsys [label="{fsys module|<f1>f1|<f2>f2|<f3>f3|<f4>f4|<f5>f5|<f6>f6}"];
    fsys_label -> fsys [style=invis];
}

subgraph cluster_loader {
    color   = "gray";
    bgcolor = "mintcream";
    loader_label [label="Loader Module" shape=none];
    loader1 [label="{loader1|<f1>f1}"];
    loader2 [label="{loader2|<f1>f2}"];
    loader3 [label="{loader3|<f1>f3}"];
    loader_label -> loader1 [style=invis];
}

loader1 -> loader2 -> loader3;
//{rank=same core fsys loader2}
}

I guess then I  am not sure

I guess then I  am not sure what you are after. When I run dot on your second graph, all of the clusters are aligned across the top. Maybe you can explain again what you are after, or provide a sketch.

the second graph is look like

the second graph is look like cluster1.png.

what i want is like cluster2.png. 

Okay, I now understand. You

Okay, I now understand. You can't get this using dot alone, as nodes are vertically centered on their respective ranks. You will have to go with my second suggestion:

ccomps -xC cl.gv | dot | gvpack -array_t3 out.gv | neato -n2 -Tpng > out.png

I update my graphviz, and it

I update my graphviz, and it works very good, that's what I want.

Thanks.