For those horizontal chains, I suggest you use TreeLayout instead of GridLayout.
If nodes of type 4-5 are in a group, that group could be in the CircularLayout too.
<!DOCTYPE html>
<html>
<head>
<title>Minimal GoJS Sample</title>
<!-- Copyright 1998-2023 by Northwoods Software Corporation. -->
</head>
<body>
<div id="myDiagramDiv" style="border: solid 1px black; width:100%; height:600px"></div>
<textarea id="mySavedModel" style="width:100%;height:250px"></textarea>
<script src="go.js"></script>
<script src="../extensions/TableLayout.js"></script>
<script id="code">
const $ = go.GraphObject.make;
const myDiagram =
new go.Diagram("myDiagramDiv",
{
layout: $(TableLayout),
"undoManager.isEnabled": true,
"ModelChanged": e => { // just for demonstration purposes,
if (e.isTransactionFinished) { // show the model data in the page's TextArea
document.getElementById("mySavedModel").textContent = e.model.toJson();
}
}
});
myDiagram.nodeTemplate =
$(go.Node, "Auto",
$(go.Shape, { fill: "white" },
new go.Binding("fill", "color")),
$(go.TextBlock, { margin: 8 },
new go.Binding("text"))
);
myDiagram.groupTemplate =
$(go.Group,
new go.Binding("row"),
{ margin: 25, layout: $(go.TreeLayout ) },
new go.Binding("layout", "circular",
c => $(go.CircularLayout,
{
spacing: 25,
sorting: go.CircularLayout.Optimized,
startAngle: 220, sweepAngle: 270,
direction: go.CircularLayout.Counterclockwise
})),
$(go.Placeholder)
),
myDiagram.model = new go.GraphLinksModel(
[
{ key: -1, isGroup: true, row: 0 },
{ key: 1, text: "Alpha", color: "lightblue", group: -1 },
{ key: 2, text: "Beta", color: "lightblue", group: -1 },
{ key: 3, text: "Gamma", color: "lightblue", group: -1 },
{ key: -2, isGroup: true, row: 1 },
{ key: 4, text: "Delta", color: "lightgreen", group: -2 },
{ key: 5, text: "Epsilon", color: "lightgreen", group: -2 },
{ key: -3, isGroup: true, row: 2, circular: true },
{ key: 6, text: "Zeta", color: "orange", group: -3 },
{ key: 7, text: "Eta", color: "orange", group: -3 },
{ key: 8, text: "Theta", color: "orange", group: -3 },
{ key: 9, text: "Iota", color: "orange", group: -3 },
{ key: 10, text: "Kappa", color: "orange", group: -3 },
{ key: 11, text: "Lambda", color: "orange", group: -3 },
{ key: 12, text: "Mu", color: "orange", group: -3 },
{ key: 13, text: "Nu", color: "orange", group: -3 },
],
[
{ from: 1, to: 2 },
{ from: 2, to: 3 },
{ from: 1, to: 4 },
{ from: 3, to: 5 },
{ from: 4, to: 5 },
{ from: 5, to: 6 },
{ from: 6, to: 7 },
{ from: 7, to: 8 },
{ from: 8, to: 9 },
{ from: 9, to: 10 },
{ from: 10, to: 11 },
{ from: 11, to: 12 },
{ from: 12, to: 13 },
{ from: 13, to: 4 },
]);
</script>
</body>
</html>