vivainsights.p2p_data_sim¶
Simulate a person-to-person network using the Watts-Strogatz model.
Organizational data fields are also simulated for Organization, LevelDesignation, and City data frame with the same column structure as a person-to-person flexible query. This has an edgelist structure and can be used directly as an input to network_p2p().
- vivainsights.p2p_data_sim.p2p_data_sim(dim=1, size=300, nei=5, p=0.05)[source]¶
Simulate a person-to-person network dataset.
Generate a synthetic person-to-person edgelist using the Watts-Strogatz small-world model. Organizational attributes (
Organization,LevelDesignation,City) are simulated for both primary and secondary collaborators. The output can be passed directly tonetwork_p2p().- Parameters:
dim (int, default 1) – Dimension of the Watts-Strogatz lattice.
size (int, default 300) – Number of nodes in the network.
nei (int, default 5) – Number of neighbours each node is connected to in the lattice.
p (float, default 0.05) – Rewiring probability.
- Returns:
An edgelist DataFrame with columns for person IDs, organizational attributes, and a
StrongTieScorecolumn.- Return type:
pandas.DataFrame
Examples
Generate a small simulated network:
>>> import vivainsights as vi >>> sim = vi.p2p_data_sim(size=50)
Customize the Watts-Strogatz parameters:
>>> sim = vi.p2p_data_sim(size=100, dim=2, nei=3, p=0.1)