Skip to content

[Query] Dataflow Cluster

github-actions[bot] edited this page Jul 21, 2026 · 1 revision

This document was generated from 'src/documentation/wiki-query.ts' on 2026-07-21, 13:40:52 UTC presenting an overview of flowR's query API (v2.13.1). Please do not edit this file/wiki page directly.

Dataflow Cluster Query [overview]

Calculates and returns all the clusters present in the dataflow graph.
This query is requested with the type dataflow-cluster.

This query automatically calculates clusters in flowR's dataflow graph and returns a list of all clusters found. Clusters are to be interpreted as literal clusters on the graph traversing edges in both directions. From this perspective, the code x <- 1; x has one cluster (given that all code is related), while the code x <- 1; y has two clusters (given that the y has no relation to the previous definition).

Example x <- 1; x
[
  {
    "type": "dataflow-cluster"
  }
]

(This can be shortened to @dataflow-cluster when used with the REPL command :query).

Results (prettified and summarized):

Query: dataflow-cluster (2ms)
   ╰ Found 1 cluster
      ╰ {3, 0, 1, 2} (marked)
All queries together required ≈2 ms (1ms accuracy, total 3 ms)

Show Detailed Results as Json

The analysis required 3.1 ms (including parsing and normalization and the query) within the generation environment.

In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR. Please consult the Interface wiki page for more information on how to get those.

{
  "dataflow-cluster": {
    ".meta": {
      "timing": 2
    },
    "clusters": [
      {
        "startNode": 3,
        "members": [
          3,
          0,
          1,
          2
        ],
        "hasUnknownSideEffects": false
      }
    ]
  },
  ".meta": {
    "timing": 2
  }
}
Example x <- 1; y
[
  {
    "type": "dataflow-cluster"
  }
]

(This can be shortened to @dataflow-cluster when used with the REPL command :query).

Results (prettified and summarized):

Query: dataflow-cluster (3ms)
   ╰ Found 2 clusters
      ╰ {3} (marked)
      ╰ {2, 1, 0} (marked)
All queries together required ≈3 ms (1ms accuracy, total 4 ms)

Show Detailed Results as Json

The analysis required 3.6 ms (including parsing and normalization and the query) within the generation environment.

In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR. Please consult the Interface wiki page for more information on how to get those.

{
  "dataflow-cluster": {
    ".meta": {
      "timing": 3
    },
    "clusters": [
      {
        "startNode": 3,
        "members": [
          3
        ],
        "hasUnknownSideEffects": false
      },
      {
        "startNode": 2,
        "members": [
          2,
          1,
          0
        ],
        "hasUnknownSideEffects": false
      }
    ]
  },
  ".meta": {
    "timing": 3
  }
}

Using the example code from above, the following query returns all clusters:

[ { "type": "dataflow-cluster" } ]

(This can be shortened to @dataflow-cluster when used with the REPL command :query).

Results (prettified and summarized):

Query: dataflow-cluster (8ms)
   ╰ Found 5 clusters
      ╰ {89, 87, 85, 82, 18, 22, ... (see JSON)} (marked)
      ╰ {55, 52, 38, 12, 16, 14, ... (see JSON)} (marked)
      ╰ (has unknown side effect) {11, 9} (marked)
      ╰ (has unknown side effect) {7, 5} (marked)
      ╰ (has unknown side effect) {3, 1} (marked)
All queries together required ≈8 ms (1ms accuracy, total 9 ms)

Show Detailed Results as Json

The analysis required 8.5 ms (including parsing and normalization and the query) within the generation environment.

In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR. Please consult the Interface wiki page for more information on how to get those.

{
  "dataflow-cluster": {
    ".meta": {
      "timing": 8
    },
    "clusters": [
      {
        "startNode": 89,
        "members": [
          89,
          87,
          85,
          82,
          18,
          22,
          20,
          23,
          57,
          60,
          58,
          67,
          65,
          62,
          63,
          79,
          72,
          69,
          70,
          77,
          74,
          75,
          83
        ],
        "hasUnknownSideEffects": false
      },
      {
        "startNode": 55,
        "members": [
          55,
          52,
          38,
          12,
          16,
          14,
          17,
          26,
          29,
          27,
          31,
          32,
          24,
          34,
          36,
          50,
          48,
          44,
          43,
          47,
          46,
          54
        ],
        "hasUnknownSideEffects": false
      },
      {
        "startNode": 11,
        "members": [
          11,
          9
        ],
        "hasUnknownSideEffects": true
      },
      {
        "startNode": 7,
        "members": [
          7,
          5
        ],
        "hasUnknownSideEffects": true
      },
      {
        "startNode": 3,
        "members": [
          3,
          1
        ],
        "hasUnknownSideEffects": true
      }
    ]
  },
  ".meta": {
    "timing": 8
  }
}
Implementation Details

Responsible for the execution of the Dataflow Cluster Query query is executeDataflowClusterQuery in ./src/queries/catalog/cluster-query/cluster-query-executor.ts.

Clone this wiki locally