cugraph.spectralModularityMaximizationClustering#

cugraph.spectralModularityMaximizationClustering(G, num_clusters, num_eigen_vects=2, evs_tolerance=1e-05, evs_max_iter=100, kmean_tolerance=1e-05, kmean_max_iter=100)[source]#

Compute a clustering/partitioning of the given graph using the spectral modularity maximization method.

Parameters:
Gcugraph.Graph or networkx.Graph

cuGraph graph descriptor. This graph should have edge weights.

num_clustersinteger

Specifies the number of clusters to find

num_eigen_vectsinteger, optional

Specifies the number of eigenvectors to use. Must be lower or equal to num_clusters. Default is 2

evs_tolerance: float, optional

Specifies the tolerance to use in the eigensolver. Default is 0.00001

evs_max_iter: integer, optional

Specifies the maximum number of iterations for the eigensolver. Default is 100

kmean_tolerance: float, optional

Specifies the tolerance to use in the k-means solver. Default is 0.00001

kmean_max_iter: integer, optional

Specifies the maximum number of iterations for the k-means solver. Default is 100

Returns:
dfcudf.DataFrame

GPU data frame containing two cudf.Series of size V: the vertex identifiers and the corresponding cluster assignments.

df[‘vertex’]cudf.Series

contains the vertex identifiers

df[‘cluster’]cudf.Series

contains the cluster assignments

Examples

>>> from cugraph.datasets import karate
>>> G = karate.get_graph(download=True)
>>> df = cugraph.spectralModularityMaximizationClustering(G, 5)