contact_networks#

This module generates the household, school, and workplace contact networks.

Functions

compute_layer_degree_description

Compute a description of the statistics for the degree distribution by age for a layer in the population contact network.

count_layer_degree

Create a dataframe from the population of people in the layer, including their uid, age, degree, and the ages of contacts in the layer.

create_reduced_contacts_with_group_types

Create contacts between members of group 1 and group 2, fixing the average degree, and the probability of an edge between any two groups controlled by p_matrix if provided.

filter_people

Helper function to filter people based on their uid and age.

get_contact_counts_by_layer

Method to count the number of contacts for individuals in the population based on their role in a layer and the role of their contacts.

get_expected_density

Calculate the expected density of an undirected graph with no self-loops given graph properties.

make_contacts

From microstructure objects (dictionary mapping ID to age, lists of lists in different settings, etc.), create a dictionary of individuals.

random_graph_model

Generate edges for a group of individuals given their ids from an Erdos-Renyi random graph model given the expected average degree.