cdlib.algorithms.ego_networks

ego_networks(g_original: object, level: int = 1) → cdlib.classes.node_clustering.NodeClustering

Ego-networks returns overlapping communities centered at each nodes within a given radius.

Supported Graph Types

Undirected Directed Weighted
Yes No No
Parameters:
  • g_original – a networkx/igraph object
  • level – extrac communities with all neighbors of distance<=level from a node. Deafault 1
Returns:

NodeClustering object

Example:
>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> coms = algorithms.ego_networks(G)