dynetx.DynGraph.time_slice¶
-
DynGraph.
time_slice
(t_from, t_to=None)¶ Return an new graph containing nodes and interactions present in [t_from, t_to].
Parameters: - t_from (snapshot id, mandatory) –
- t_to (snapshot id, optional (default=None)) – If None t_to will be set equal to t_from
Returns: H – the graph described by interactions in [t_from, t_to]
Return type: a DynGraph object
Examples
>>> import dynetx as dn >>> G = dn.DynGraph() >>> G.add_path([0,1,2,3], t=0) >>> G.add_path([0,4,5,6], t=1) >>> G.add_path([7,1,2,3], t=2) >>> H = G.time_slice(0) >>> H.interactions() [(0, 1), (1, 2), (1, 3)] >>> H = G.time_slice(0, 1) >>> H.interactions() [(0, 1), (1, 2), (1, 3), (0, 4), (4, 5), (5, 6)]