cdlib.algorithms.lswl¶
-
lswl
(g_original: object, query_node: object, strength_type: int = 2, timeout: float = 1.0, online: bool = True) → cdlib.classes.node_clustering.NodeClustering¶ LSWL locally discovers networks’ the communities precisely, deterministically, and quickly. This method works in a one-node-expansion model based on a notion of strong and weak links in a graph.
Parameters: - g_original – a networkx/igraph object
- timeout – The maximum time in which LSWL should retrieve the community. Default is 1 second.
- strength_type – 1 strengths between [-1,+1] or, 2 strengths between [0,1]. Default, 2.
- query_node – Id of the network node whose local community is queried.
- online – wehter the computation should happen in memory or not. Default, True.
Returns: NodeClustering object
Example: >>> from cdlib import algorithms >>> import networkx as nx >>> G = nx.karate_club_graph() >>> coms = algorithms.lswl(G, 1)
References: Fast Local Community Discovery: Relying on the Strength of Links (submitted for KDD 2021).
Note
Reference implementation: https://github.com/mahdi-zafarmand/LSWL