consecutive_cluster
¶
consecutive_cluster(cluster: array) -> Tuple[array, array]
Relabels cluster ids to consecutive integers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cluster
|
array
|
Cluster id of each node, of shape |
required |
Returns:
| Type | Description |
|---|---|
A tuple `(cluster, perm)`
|
the new cluster ids in `[0, |
array
|
num_clusters)` (in increasing order of the original ids), and for |
Tuple[array, array]
|
each cluster the index of one of its nodes (the last one), as in PyG. |
Source code in mlx_graphs/utils/clustering.py
from mlx_graphs.utils import consecutive_cluster · mlx_graphs/utils/clustering.py