networksns.centrality_measures.trip_centrality¶
- networksns.centrality_measures.trip_centrality(edge_list, alpha, epsilon=None)¶
Computes the trip centrality of a temporal multiplex.
Trip centrality is a generalization of Katz centrality to the case of a temporal multiplex with non-zero link travel time. It counts the paths that can be travelled according to the network temporal structure while also differentiating the contributions of inter- and intra-layer walks to centrality.
The parameters \(\alpha\) and \(\epsilon\) determine the value of the contribution given by a walk of length \(n\) changing layer \(m\) times. This value is \({\alpha}^n{\varepsilon}^m\).
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].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:
tc: (dictionary) trip 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 trip centrality.
>>> tc = cm.trip_centrality(edge_list, 0.3, 0.2)
References