networksns.centrality_measures.broadcast_centrality¶
- networksns.centrality_measures.broadcast_centrality(G, alpha=None, conj_grad_maxiter=100, conj_grad_tol=1e-07)¶
Computes the broadcast centrality of the dynamic graph \(G\).
Denoting with \(A_t\) the adjacency matrix at time \(t\) and with \(\mathbf{1}\) the vector of all ones broadcast centrality is \(bc = (I-\alpha A_1)^{-1}(I-\alpha A_2)^{-1}...(I-\alpha A_k)^{-1} \mathbf{1}\) [1].
Recall that to ensure that each resolvent \((I-\alpha A_t)\) can be expressed as a power series in the matrix, the parameter \(\alpha\) must satisfy \(0<\alpha< \frac{1}{\rho^*}\), where \(\rho^* = \max_t \rho(A_t)\).
- Parameters:
G (DynGraph object) – a dynamic graph.
alpha (float, optional) – parameter, if None computed to ensure that each resolvent can be expressed as a power series in the matrix, default: None.
conj_grad_maxiter (integer) – Maximum number of iterations for solving \(Ax=b\) with conjugate gradient method. Iterations will stop after maxiter steps even if the specified tolerance has not been achieved, default: 100.
conj_grad_tol (float, optional) –
- Tolerance for solving \(Ax=b\) with conjugate gradient method.
norm(residual) <= conj_grad_tol*norm(b), default: 1e-7.
- Returns:
bc (dict) – broadcast centrality.
alpha (float) – alpha parameter.
Examples
>>> from networksns import centrality_measures as cm >>> import dynetx as dn
Create dynamic graph \(G\)
>>> G = dn.DynGraph() >>> G.add_interaction(1, 2, 2, 5) >>> G.add_interaction(1, 3, 2, 5) >>> G.add_interaction(2, 3, 4) EdgeView([(1, 2), (1, 3), (2, 3)])
Compute broadcast centrality
>>> bc, alpha = cm.broadcast_centrality(G)
References