networksns.centrality_measures.betweenness_centrality¶
- networksns.centrality_measures.betweenness_centrality(edge_list, delta_t, alpha, epsilon)¶
Computes the betweenness centrality of a temporal multiplex.
- This centrality is a generalization of betweenness centrality to the case of a temporal multiplex with non-zero link travel time.
In identifying the shortest paths it takes in account both the temporal and the multiplex structure, differentiating the contributions of inter- and intra-layer walks to centrality.
The parameters \(\alpha\) and \(\epsilon\) determine the length of a path according to the formula
\(\phantom{aaaaaaaaaaaaaaaaaaa}\mathcal{L} = \alpha (n+\varepsilon m) + (1-\alpha)\mathcal{T}\).
where \(n\) is the number of intra-layer links used, \(m\) is the number of inter-layer links, \(\mathcal{T}\) is the duration of the path, \(\alpha \leq 1\) and \(\varepsilon \in [0, +\infty)\).
For a full description of the algorithm see [1].
- Parameters:
edge_list (List of lists) – When there are multiple layers the edge structure is the following
[departure_node, arrival_node, departure_time, arrival_time, layer]. While with only one layer[departure_node, arrival_node, departure_time, arrival_time].delta_t (int) – Time interval.
alpha (float, optional) – parameter.
epsilon (float, optional) – parameter, if None changing layer does not influence the contribution of a walk. When there is only one layer does not need to be specified, default: None.
- Returns:
bc: (dictionary) betweenness centrality.
Examples
>>> from networksns import centrality_measures as cm >>> >>>
Create multiplex edge list
>>> edge_list = [['u', 'v' ,1 , 3, 'l'], ['u', 'w', 1, 2, 'l'], ['w', 'u', 1, 5, 'm'], >>> ['u', 'v' ,2 , 4, 'm'], ['u', 'w', 3, 4, 'm'], ['w', 'u', 4, 5, 'r'], >>> ['u', 'v' ,1 , 5, 'm'], ['v', 'w', 2, 3, 'm'], ['v', 'u', 4, 5, 'r']]
Compute betweenness centrality
>>> bc = cm.betweenness_centrality(edge_list, 1, 0.3, 0.2)
References