def angel(g_original, threshold, min_community_size=3): """ Angel is a node-centric bottom-up community discovery algorithm. It leverages ego-network structures and overlapping label propagation to identify micro-scale communities that are subsequently merged in mesoscale ones. Angel is the, faster, successor of Demon. :param g_original: a networkx/igraph object :param threshold: merging threshold in [0,1]. :param min_community_size: minimum community size, default 3. :return: NodeClustering object :Example: >>> from cdlib import algorithms >>> import networkx as nx >>> G = nx.karate_club_graph() >>> coms = algorithms.angel(G, min_com_size=3, threshold=0.25) :References: 1. Rossetti, Giulio. "Exorcising the Demon: Angel, Efficient Node-Centric Community Discovery." International Conference on Complex Networks and Their Applications. Springer, Cham, 2019. .. note:: Reference implementation: https://github.com/GiulioRossetti/ANGEL """ if ig is None: raise ModuleNotFoundError( "Optional dependency not satisfied: install igraph to use the selected feature." ) if Angel is None: raise ModuleNotFoundError( "Optional dependency not satisfied: install angel-cd library to use the selected feature (likely pip install angel-cd). If using a notebook, you need also to restart your runtime/kernel." ) g = convert_graph_formats(g_original, ig.Graph) with suppress_stdout(): a = Angel(graph=g, min_comsize=min_community_size, threshold=threshold, save=False) coms = a.execute() return NodeClustering(list(coms.values()), g_original, "ANGEL", method_parameters={ "threshold": threshold, "min_community_size": min_community_size }, overlap=True)
def angel(g, threshold, min_community_size=3): """ Angel is a node-centric bottom-up community discovery algorithm. It leverages ego-network structures and overlapping label propagation to identify micro-scale communities that are subsequently merged in mesoscale ones. Angel is the, faster, successor of Demon. :param g: a networkx/igraph object :param threshold: merging threshold in [0,1]. :param min_community_size: minimum community size, default 3. :return: NodeClustering object :Example: >>> from cdlib import algorithms >>> import networkx as nx >>> G = nx.karate_club_graph() >>> coms = algorithms.angel(G, min_com_size=3, threshold=0.25) :References: 1. Rossetti G. **Angel: efficient, and effective, node-centric community discovery in static and dynamic networks.** .. note:: Reference implementation: https://github.com/GiulioRossetti/ANGEL """ if ig is None: raise ModuleNotFoundError( "Optional dependency not satisfied: install igraph to use the selected feature." ) g = convert_graph_formats(g, ig.Graph) with suppress_stdout(): a = Angel(graph=g, min_comsize=min_community_size, threshold=threshold, save=False) coms = a.execute() return NodeClustering(list(coms.values()), g, "ANGEL", method_parameters={ "threshold": threshold, "min_community_size": min_community_size }, overlap=True)