Compute the preferential attachment score of all node pairs in ebunch.
Preferential attachment score of \(u\) and \(v\) is defined as
where \(\Gamma(u)\) denotes the set of neighbors of \(u\).
Parameters: | G : graph
ebunch : iterable of node pairs, optional (default = None)
|
---|---|
Returns: | piter : iterator
|
References
[R264] | D. Liben-Nowell, J. Kleinberg. The Link Prediction Problem for Social Networks (2004). http://www.cs.cornell.edu/home/kleinber/link-pred.pdf |
Examples
>>> import networkx as nx
>>> G = nx.complete_graph(5)
>>> preds = nx.preferential_attachment(G, [(0, 1), (2, 3)])
>>> for u, v, p in preds:
... '(%d, %d) -> %d' % (u, v, p)
...
'(0, 1) -> 16'
'(2, 3) -> 16'