Previous: Default and Refinement Styles for Graphviz Graphs, Up: Graph Language Reference [Contents]

### 10.3 Clusters

When using the `dot` layout algorithm, graphviz makes it possible to make subgraphs visible by drawing a rectangle around the nodes inside the subgraph. By convention this feature is activated if the name of the subgraph starts with ‘`cluster`’. In Msc-generator, you can use the `cluster` keyword instead of `subgraph`, to create a visible subgraph. You do not need to append the ‘`cluster_`’ prefix to its name. Also, whatever name you specify will also become the default label. Omitting the name will result in an empty label and an auto-generated name, like ‘`cluster_xxx`’, where ‘`xxx`’ is an auto-incremented number.

Msc-generator also supports cluster subgraph collapsing/expansion. When in the GUI, you hoover over a cluster subgraph, a collapse icon (red minus sign) appears at the top-right corner of the cluster. (Similar to how it happens with boxes and group entities in signalling charts.) Clicking that (or double clicking anywhere in the cluser) collapses the subgraph into a single, double-lined node of shape box. In the GUI there are buttons to collapse or expand all subgraphs with one click.

When collapsing a subgraph multiple edges from within the subgraph to the same node outside will be kept if the graph is not `strict`. Use the `collapse_strict=yes;` chart option to remove duplicate edges on collapsing a subgraph. In this case `edge_collapsed` style is applied to the remaining edge. Similar, nodes that result after the collapse of a subgraph are applied the `cluster_collapsed` style instead of `cluster`.