Weighted unipartite projection of B onto the nodes of one bipartite node set using the collaboration model.
The collaboration weighted projection is the projection of the bipartite network B onto the specified nodes with weights assigned using Newman’s collaboration model [R80]:
..math:
w_{v,u} = \sum_k \frac{\delta_{v}^{w} \delta_{w}^{k}}{k_w - 1}
where and are nodes from the same bipartite node set, and is a node of the opposite node set. The value is the degree of node in the bipartite network and is 1 if node is linked to node in the original bipartite graph or 0 otherwise.
The nodes retain their names and are connected in the resulting graph if have an edge to a common node in the original bipartite graph.
Parameters : | B : NetworkX graph
nodes : list or iterable
|
---|---|
Returns : | Graph : NetworkX graph
|
See also
networkx.algorithms.bipartite.basic.is_bipartite, networkx.algorithms.bipartite.basic.is_bipartite_node_set, networkx.algorithms.bipartite.basic.sets, weighted_projected_graph, overlap_weighted_projected_graph, generic_weighted_projected_graph, projected_graph
Notes
No attempt is made to verify that the input graph B is bipartite. The graph and node properties are (shallow) copied to the projected graph.
References
[R80] | (1, 2) Scientific collaboration networks: II. Shortest paths, weighted networks, and centrality, M. E. J. Newman, Phys. Rev. E 64, 016132 (2001). |
Examples
>>> from networkx.algorithms import bipartite
>>> B = nx.path_graph(5)
>>> B.add_edge(1,5)
>>> G = bipartite.collaboration_weighted_projected_graph(B, [0, 2, 4, 5])
>>> print(G.nodes())
[0, 2, 4, 5]
>>> for edge in G.edges(data=True): print(edge)
...
(0, 2, {'weight': 0.5})
(0, 5, {'weight': 0.5})
(2, 4, {'weight': 1.0})
(2, 5, {'weight': 0.5})