src.algorithms package

Subpackages

Submodules

src.algorithms.Algorithm module

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

Bases: object

Base class for graph clustering algorithms

Parameters:

graph (Graph) – Graph object

evaluate() list[str, float][source]

Evaluates the clustering through various supervised (if labels provided in the Graph object) and unsupervised metrics:

Supervised:

  • Accuracy

  • Normalized Mutual Information

  • Adjusted Rand Index

Unsupervised:

  • Conductance

  • Silhouette

  • Modularity

get_clusters() list[int][source]

Returns the clusters

Returns:

Clusters

Return type:

list[int]

get_communities() list[list[int]][source]

Returns the clusters as communities (list of nodes list)

Returns:

Clusters as communities

Return type:

list[list[int]]

run() None[source]

Runs the algorithm

Module contents