# compressCluster - simplify graphs by replacing clusters with single nodes

**URL:** <https://forum.graphviz.org/t/compresscluster-simplify-graphs-by-replacing-clusters-with-single-nodes/2983>\
**Category:** Announcements\
**Created:** [May 21, 2025, 8:59pm UTC](https://forum.graphviz.org/t/compresscluster-simplify-graphs-by-replacing-clusters-with-single-nodes/2983 "2025-05-21T20:59:55Z")\
**Posts on this page:** 2\
**Page:** 1

<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:** [May 21, 2025, 8:59pm UTC](https://forum.graphviz.org/t/compresscluster-simplify-graphs-by-replacing-clusters-with-single-nodes/2983/1 "2025-05-21T20:59:55Z")

</div>

compressCluster.gvpr is a **gvpr** program that can be used as either  
a preprocessor - feeding its output into dot  
or  
a postprocessor - taking dot output and modifying the output

It takes a list of 1 or more cluster names and the **dot** file name and replaces the named clusters with simple nodes. All nodes and edges that are internal to the listed clusters are deleted.

compressCluster.gvpr can be found here: [compressCluster.gvpr - replace a Graphviz cluster (and contents) with a single node · GitHub](https://gist.github.com/steveroush/eb3743f0cc234339ea1b18f3c3de85f1)

A very small example:  
This:

 ![COMPRESS.simplecluster.original](https://global.discourse-cdn.com/graphviz/original/2X/3/335a2af4499057e54420c8833abc8cc302a73c30.png)

Becomes:

 ![COMPRESS.COMPRESS.simplecluster.original.cluster2](https://global.discourse-cdn.com/graphviz/original/2X/c/ca714d2edf86d5f479ea7c6f86c776361ff77256.png)

---

<div class="post-metadata">

**Author:** ![BartB](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@BartB](https://forum.graphviz.org/u/BartB)\
**Post date:** [June 22, 2025, 7:28am UTC](https://forum.graphviz.org/t/compresscluster-simplify-graphs-by-replacing-clusters-with-single-nodes/2983/2 "2025-06-22T07:28:00Z")

</div>

If you want to collapse/ expand by clicking on the cluster take a look at this: [GitHub - BartBrood/Interactive-Graphviz-Diagrams: Dynamic Graphviz graphs with collapsible cluster/expandible clusters and edge highlighting through user clicks. Uses either csv files or dot as a source.](https://github.com/BartBrood/Interactive-Graphviz-Diagrams)
