face2face.imports.create_network.hopping_time_networks

face2face.imports.create_network.hopping_time_networks(Data, minutes=1000)

Create multiple Networkx Graphs and DataFrames

Creating multiple Networkx Graphs and DataFrames based on the given hopping time interval.

Parameters
  • Data (Data) – Data Object that contains Tij- and Metadata for a data set.

  • minutes (int) – The interval time in which the Networkx Graphs should be splitted.

Returns

  • network_list (list) – A list of all networkx Graphs for the given interval.

  • df_list (list) – A list of all dataframes for the given interval.

Examples

In this example the full dataframe got splitted in dataframes and networks with time windows of 40 seconds (2/3 minutes). The output in this case describes the network and the dataframe for the first 40 seconds in the original dataframe.

>>> 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 = hopping_time_networks(test_df, minutes=2/3)
>>> print(test_network_list[0].edges)
[(0, 1), (1, 2), (1, 3), (2, 3)]
>>> print(test_network_list[0].nodes)
[0, 1, 2, 3]
>>> for i in test_network_list[0].nodes:
    >>> print(test_network_list[0].nodes[i])
{'Age': 1.0, 'Sex': 'F'}
{'Age': 0.0, 'Sex': nan}
{'Age': nan, 'Sex': 'M'}
{'Age': 0.0, 'Sex': 'F'}
>>> print(test_df_list[0])
   Time  i  j  TimeGroup
0    20  0  1   0.0-40.0
1    40  1  2   0.0-40.0
2    40  1  3   0.0-40.0
3    40  2  3   0.0-40.0

See also

face2face.imports.create_network.create_sliding_time_networks(), face2face.imports.create_network.event_time_networks()