face2face.imports.create_network.sliding_time_networks¶
-
face2face.imports.create_network.
sliding_time_networks
(Data, slide=1, interval=1000)¶ Create multiple Networkx Graphs and DataFrames
Creating multiple Networkx Graphs and DataFrames based on the given interval and the sliding time interval.
- Parameters
Data (Data) – Data Object that contains Tij- and Metadata for a data set.
slide (int) – The time steps in which the intervals should be created.
interval (int) – The interval time in which the networkx Graphs should be splitted.
- Returns
network_list (list) – A list of all networkx Graphs for a given interval.
df_list (list) – A list of all dataframes for a given interval.
Examples
>>> attr_list = ["ID", "Age", "Sex"] >>> test_df = Data(path_tij="face2face/data/Test/tij_test.dat", separator_tij="\t", >>> path_meta="face2face/data/Test/meta_test.dat", separator_meta = "\t", >>> meta_attr_list=attr_list) >>> test_network_list, test_df_list = sliding_time_networks(test_df, slide=1/3, interval=2/3) >>> print(test_df_list[0]) Time i j TimeGroup 0 20 0 1 0-40.0 1 40 1 2 0-40.0 3 40 1 3 0-40.0 5 40 2 3 0-40.0 >>> print(test_network_list[0].nodes) [0, 1, 2, 3] >>> print(test_network_list[0].edges) [(0, 1), (1, 2), (1, 3), (2, 3)] >>> print(test_df_list[1]) Time i j TimeGroup 2 40 1 2 20.0-60.0 4 40 1 3 20.0-60.0 6 40 2 3 20.0-60.0 7 60 4 6 20.0-60.0 9 60 4 7 20.0-60.0 11 60 6 7 20.0-60.0 >>> print(test_network_list[1].nodes) [1, 2, 3, 4, 6, 7] >>> print(test_network_list[1].edges) [(1, 2), (1, 3), (2, 3), (4, 6), (4, 7), (6, 7)]