cdlib.algorithms.eigenvector

cdlib.algorithms.eigenvector(g_original: object, weights: object | None = None) → NodeClustering

Newman’s leading eigenvector method for detecting community structure based on modularity. This is the proper internal of the recursive, divisive algorithm: each split is done by maximizing the modularity regarding the original network.

Supported Graph Types

Undirected

Directed

Weighted

Yes

No

Yes

Parameters:
  • g_original – a networkx/igraph object

  • weights – list of double, or edge attribute Weights of edges. Can be either an iterable or an edge attribute. Default None

Returns:

NodeClustering object

Example:

>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> com = algorithms.eigenvector(G)
References:

Newman, Mark EJ. Finding community structure in networks using the eigenvectors of matrices. Physical review E 74.3 (2006): 036104.