cdlib.algorithms.mod_r

mod_r(g_original: object, query_node: object) → cdlib.classes.node_clustering.NodeClustering

Community Discovery algorithm that infers the hierarchy of communities that enclose a given vertex by exploring the graph one vertex at a time.

Supported Graph Types

Undirected Directed Weighted
Yes No No
Parameters:
  • g_original – a networkx/igraph object
  • query_node – Id of the network node whose local community is queried.
Returns:

NodeClustering object

Example:
>>> from cdlib import algorithms
>>> import networkx as nx
>>> G = nx.karate_club_graph()
>>> coms = algorithms.mod_r(G, 1)
References:

Clauset, Aaron. “Finding local community structure in networks.” Physical review E 72.2 (2005): 026132.

Note

Reference implementation: https://github.com/mahdi-zafarmand/LSWL