sgtl.clustering.spectral_clustering#

sgtl.clustering.spectral_clustering(graph: Graph, num_clusters: int, num_eigenvectors=None) List[List[int]]#

Perform spectral clustering on the given graph object.

Parameters:
  • graph – an SGTL graph object

  • num_clusters – the number of clusters to find

  • num_eigenvectors – (optional) the number of eigenvectors to use to find the clusters

Returns:

A list of lists. Each list corresponds to the indices of the vertex in that cluster.

Raises:

ValueError – if the requested number of clusters or eigenvectors are not a positive integer