aryagraph.algorithms.link_prediction.predict_links#
- aryagraph.algorithms.link_prediction.predict_links(g: Any, method: str = 'adamic_adar', k: int = 10) list[tuple[Hashable, Hashable, float]][source]#
The k most likely missing links as
(u, v, score), best first.method is
"adamic_adar","resource_allocation","jaccard","common_neighbors"or"preferential_attachment". Ties keep graph order. Neighbourhood methods only score pairs two hops apart (all others score 0), and pad with zero-score pairs when fewer than k exist.>>> predict_links(g, "jaccard", k=3) [(u1, v1, 0.8), (u2, v2, 0.75), (u3, v3, 0.5)]