Skip to content

Cluster network

fast step  network • graph • louvain • community detection

Identify clusters in the network.

At the moment the only supported clustering algorithm is Louvain. Louvain tries to identify the communities in a network by optimizing the modularity of the whole network, that is a measure of the density of edges inside communities to edges outside communities. The result is a column of cluster IDs (integers), where the value -1 is reserved for nodes in very small clusters, which are grouped into a "noise" cluster.

Usage


The following are the step's expected inputs and outputs and their specific types.

Step signature
cluster_network(
    targets: list[number],
    *weights: list[number], {
    "param": value
}) -> (cluster: column)

where the object {"param": value} is optional in most cases and if present may contain any of the parameters described in the corresponding section below.

Example

The following configuration allows for smallish clusters and considers fewish data points as noise:

Example call (in recipe editor)
cluster_network(ds.targets, ds.weights, {
  "resolution": 0.3,
  "noise": 5
}) -> (ds.cluster)

Inputs


targets: column:list[number]

A column containing link targets. Source is implied in the index.


*weights: column:list[number]

Outputs


cluster: column

A column containing cluster tags.

Parameters


algorithm: string = "louvain"

Clustering algorithm to use.

Must be one of: "louvain"


resolution: number = 0.5

The higher this value the bigger the clusters.

Range: 0 < resolution ≤ 1


noise: integer = 1

The larger the value, the more conservative the clustering. Cluster with this number of nodes or less will be considered noise.

Range: 0 ≤ noise < inf


query: string

The graphext advanced query syntax used to select rows.