spatialleiden.multiplex_leiden

spatialleiden.multiplex_leiden(*neighbors, directed=True, use_weights=True, n_iterations=-1, partition_type=<class 'leidenalg.VertexPartition.RBConfigurationVertexPartition'>, layer_weights=1, partition_kwargs=None, seed=42)

Partition the nodes using multiplex leiden clustering.

For more information on multiplex leiden clustering read the leidenalg documentation.

Parameters:
  • neighbors (sparray | spmatrix | ndarray) – Matrices of row-wise neighbor definitions for the different layers i.e. cij is the connectivity of i \(\to\) j.

  • directed (bool | Collection[bool], optional) – Whether to use a directed graph for each layer, respectively.

  • use_weights (bool | Collection[bool], optional) – Whether to use weights for the edges of each layer, respectively.

  • n_iterations (int, optional) – Number of iterations to run the Leiden algorithm. If the number is negative it is run until convergence.

  • partition_type (optional) – A leidenalg.VertexPartition.MutableVertexPartition to be used.

  • layer_weights (float | Collection[float], optional) – The weights of each layer, respectively.

  • partition_kwargs (dict | None | Collection[dict | None], optional) – Keyword arguments for the partition of each layer.

  • seed (int, optional) – Random seed.

Returns:

Cluster assignment.

Return type:

ndarray[integer]