cdlib.algorithms.lpam¶
-
lpam
(g_original: object, k: int = 2, threshold: float = 0.5, distance: str = 'amp', seed: int = 0) → cdlib.classes.node_clustering.NodeClustering¶ Link Partitioning Around Medoids
Parameters: - g_original – a networkx/igraph object
- k – number of clusters
- threshold – merging threshold in [0,1], default 0.5
- distance – type of distance: “amp” - amplified commute distance, or “cm” - commute distance, or distance matrix between all edges as np ndarray
- seed – random seed for k-medoid heuristic
Returns: NodeClustering object
Example: >>> from cdlib import algorithms >>> import networkx as nx >>> G = nx.karate_club_graph() >>> coms = algorithms.lpam(G, k=2, threshold=0.4, distance = "amp")
References: Alexander Ponomarenko, Leonidas Pitsoulis, Marat Shamshetdinov. “Link Partitioning Around Medoids”. https://arxiv.org/abs/1907.08731