# Align Clusters at the top

**URL:** https://forum.graphviz.org/t/align-clusters-at-the-top/2863
**Category:** Uncategorized
**Created:** [March 25, 2025, 5:15pm UTC](https://forum.graphviz.org/t/align-clusters-at-the-top/2863 "2025-03-25T17:15:46Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bobbyr1](https://avatars.discourse-cdn.com/v4/letter/b/58956e/32.png) [@bobbyr1](https://forum.graphviz.org/u/bobbyr1)
#### Post date: [March 25, 2025, 5:15pm UTC](https://forum.graphviz.org/t/align-clusters-at-the-top/2863/1 "2025-03-25T17:15:46Z")

</div>

I’m trying to do something quite simple but I’ve spent a couple of hours with no success - hoping someone in this forum has a solution.

Essentially I’m trying to move process #2 so that it’s aligned with process #1 at the top side. And ideally the box of process #2 is the same size as process #1

 ![image](https://global.discourse-cdn.com/graphviz/original/2X/2/217e4a39f8576241d305d2c722f51e3f39713c2d.png)

```auto
[graphviz]
----
digraph G {
    fontname="Helvetica,Arial,sans-serif"
    node [fontname="Helvetica,Arial,sans-serif"]
    edge [fontname="Helvetica,Arial,sans-serif"]

    // Define subgraph for process #1
    subgraph cluster_0 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        "Reader Data (endp.)" -> "Raw Data" -> "Corrected Data" -> "Sample Data";
        label = "process #1";
    }

    // Define subgraph for process #2
    subgraph cluster_1 {
        node [style=filled];
        "Reader Data (kin.)" -> "Trace Data";
        label = "process #2";
        color=blue;
    }

    // Connect Load data to both process clusters
    "Load data" -> "Reader Data (endp.)" [lhead=cluster_1, constraint=false];
    "Load data" -> "Reader Data (kin.)" [lhead=cluster_1, constraint=false];
    "Trace Data" -> "Raw Data";
    "Sample Data" -> "Save (export, report)";

    // Define shapes for Load data and Save (export, report)
    "Load data" [shape=Mdiamond];
    "Save (export, report)" [shape=Msquare];
}
----

```

---

<div class="post-metadata">

### Author: ![steveroush](https://avatars.discourse-cdn.com/v4/letter/s/a9adbd/32.png) [@steveroush](https://forum.graphviz.org/u/steveroush)
#### Post date: [March 25, 2025, 6:36pm UTC](https://forum.graphviz.org/t/align-clusters-at-the-top/2863/2 "2025-03-25T18:36:08Z")

</div>

Fiddled with constraints & added invisible nodes to enlarge the cluster

```auto
digraph G {
    fontname="Helvetica,Arial,sans-serif"
    node [fontname="Helvetica,Arial,sans-serif"]
    edge [fontname="Helvetica,Arial,sans-serif"]

    // Define subgraph for process #1
    subgraph cluster_0 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        "Reader Data (endp.)" -> "Raw Data" -> "Corrected Data" -> "Sample Data";
        label = "process #1";
    }

    // Define subgraph for process #2
    subgraph cluster_1 {
        node [style=filled];
        "Reader Data (kin.)" -> "Trace Data"
	// added 2 invisible nodes & edges to enlarge the cluster
	edge[style=invis]
	node[style=invis]
	"Trace Data" -> dummy1 -> dummy2;
        label = "process #2";
        color=blue;
    }
    // Connect Load data to both process clusters
    "Load data" -> "Reader Data (endp.)" [lhead=cluster_1];
    "Load data" -> "Reader Data (kin.)" [lhead=cluster_1];
    "Trace Data" -> "Raw Data" [constraint=false]; // turn off constraint
    "Sample Data" -> "Save (export, report)";

    // Define shapes for Load data and Save (export, report)
    "Load data" [shape=Mdiamond];
    "Save (export, report)" [shape=Msquare];
}

```

Giving:

 ![forum2863_1](https://global.discourse-cdn.com/graphviz/original/2X/8/85faa290a226bbbdfc593297bc325b0da34dbf34.png)

---

<div class="post-metadata">

### Author: ![bobbyr1](https://avatars.discourse-cdn.com/v4/letter/b/58956e/32.png) [@bobbyr1](https://forum.graphviz.org/u/bobbyr1)
#### Post date: [March 26, 2025, 7:38am UTC](https://forum.graphviz.org/t/align-clusters-at-the-top/2863/3 "2025-03-26T07:38:13Z")

</div>

Thanks a lot! That’s exactly what I was looking for.
