cdlib.algorithms.em

em(g_original: object, k: int) → cdlib.classes.node_clustering.NodeClustering

EM is based on based on a mixture model. The algorithm uses the expectation–maximization algorithm to detect structure in networks.

Supported Graph Types

Undirected Directed Weighted
Yes Yes No
Parameters:
  • g_original – a networkx/igraph object
  • k – the number of desired communities
Returns:

NodeClustering object

Example:
>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> com = algorithms.em(G, k=3)
References:

Newman, Mark EJ, and Elizabeth A. Leicht. Mixture community and exploratory analysis in networks. Proceedings of the National Academy of Sciences 104.23 (2007): 9564-9569.

Note

Reference implementation: https://github.com/duckneo/CommunityDetection