src.algorithms.traditional package

Submodules

src.algorithms.traditional.DCSBM module

class src.algorithms.traditional.DCSBM.DCSBM(graph: Graph, num_clusters: int, iterations: int = 10000)[source]

Bases: Algorithm

Stochastic block model clustering algorithm

run() None[source]

Runs the algorithm

src.algorithms.traditional.Leiden module

class src.algorithms.traditional.Leiden.Leiden(graph: Graph, *args, **kwargs)[source]

Bases: Algorithm

Leiden clustering algorithm

run() None[source]

Runs the algorithm

src.algorithms.traditional.Louvain module

class src.algorithms.traditional.Louvain.Louvain(graph: Graph, *args, **kwargs)[source]

Bases: Algorithm

Louvain clustering algorithm

run() None[source]

Runs the algorithm

src.algorithms.traditional.Markov module

class src.algorithms.traditional.Markov.Markov(graph: Graph, expansion: int = 2, inflation: int = 2, iterations: int = 100)[source]

Bases: Algorithm

Markov clustering algorithm

Parameters:
  • graph (Graph) – Graph object

  • expansion (int) – Cluster expansion factor

  • inflation (int) – Cluster inflation factor

  • iterations (int) – Maximum number of iterations

run() None[source]

Runs the algorithm with the given parameters

src.algorithms.traditional.SBM_em module

class src.algorithms.traditional.SBM_em.EMInference(graph, objective_function, partition, with_toggle_detection=True, limit_possible_blocks=False)[source]

Bases: Inference

Expectation-Maximization Algorithm for SBM inference

infer_stochastic_block_model()[source]

Get stochastic block model

class src.algorithms.traditional.SBM_em.SBM_em(graph: Graph, num_clusters: int, iterations: int = 10000)[source]

Bases: Algorithm

Stochastic block model clustering algorithm

run() None[source]

Runs the algorithm

src.algorithms.traditional.SBM_metropolis module

class src.algorithms.traditional.SBM_metropolis.SBM_metropolis(graph: Graph, num_clusters: int, iterations: int = 10000)[source]

Bases: Algorithm

Stochastic block model clustering algorithm

run() None[source]

Runs the algorithm

src.algorithms.traditional.Spectral module

class src.algorithms.traditional.Spectral.Spectral(graph: Graph, num_clusters: int = 3)[source]

Bases: Algorithm

Spectral clustering algorithm

Parameters:
  • graph (Graph) – Graph object

  • num_clusters (int) – Maximum number of clusters to form

run() None[source]

Runs the algorithm

Parameters:

num_clusters (int) – Maximum number of clusters to form

src.algorithms.traditional.utils module

src.algorithms.traditional.utils.extract_clusters_from_communities_list(communities: list[list[int]]) list[int][source]

Extracts clusters from the output of the cdlib library / markov clustering algorithm

Parameters:

communities (list[list[int]]) – List of communities (list of nodes)

Returns:

List of clusters

Return type:

list

Module contents