Data and code from: Bivalent impact of social networks on overarming: Insights on the alignment between social and individual interests
Data files
Apr 23, 2026 version files 2.33 MB
-
gitResults.nb
2.13 MB
-
mathematica.zip
181.23 KB
-
README.md
7.54 KB
-
realnetworksimulations.zip
20.63 KB
Abstract
Associated Manuscript
Fu F, Herron M, and Rockmore D.
"Bivalent Impact of Social Networks on Overarming: Insights on the Alignment between Social and Individual Interests"
Accepted for publication in Science Advances.
Overview
This submission contains the code and supporting data needed to reproduce the results and figures associated with the manuscript. The materials include:
- a Wolfram Mathematica notebook for generating figures,
- compiled data files used by the Mathematica notebook,
- C++ code for simulations on real social networks, and
- anonymized network data used in those simulations.
Software Requirements
- Wolfram Mathematica 13.0.0.0 (or a compatible later version) is required to open and run
gitResults.nb. - A C++ compiler is required to compile and run the simulation code in
realnetworksimulations. - Files with extension
.xlsxcan be opened using spreadsheet software such as Microsoft Excel or LibreOffice Calc, or imported into Mathematica, Python, R, or MATLAB. - Files with extension
.txtare plain-text data files and can be opened with any standard text editor.
File Inventory
1. Mathematica notebook
- File:
gitResults.nb - Description: Wolfram Mathematica notebook used to reproduce main Figures 1–4 and supplementary Figures S1–S5.
2. Mathematica data archive
- Archive:
mathematica.zip - Description: Compressed archive containing intermediate and compiled data files used by the Mathematica notebook
gitResults.nbto reproduce figures and analyses from the study. - Action required: Unzip
mathematica.zipbefore runninggitResults.nb.
After unzipping, the directory mathematica/ contains the following files.
degree.txt
Text file containing the degree distribution of a simulated scale-free network.
- Column 1:
degree— node degree (number of network neighbors); unit: count - Column 2:
node_count— number of nodes with the corresponding degree; unit: count - Column 3:
node_fraction— fraction of all nodes with the corresponding degree; unitless proportion in the range [0, 1]
This file is used to generate the degree-distribution plot shown in Figure S2A.
degreeeffect.xlsx
Excel file containing the relationship between node degree and gun ownership in a simulated scale-free network.
- Column 1:
degree— node degree (number of network neighbors); unit: count - Column 2:
individual_count— number of individuals with the corresponding degree; unit: count - Column 3:
armed_fraction— fraction of individuals with that degree who are armed at equilibrium; unitless proportion in the range [0, 1]
This file is used to generate the scatter plot of gun ownership rate versus node degree shown in Figure S2B.
realnetwork.xlsx
Excel file comparing equilibrium gun ownership rates in simulated and empirical networks across values of the provocation parameter.
- Column 1:
provocation_probability— probability of provocation in the model; unitless probability in the range [0, 1] - Column 2:
armed_fraction_scale_free— equilibrium gun ownership rate in simulated scale-free networks; unitless proportion in the range [0, 1] - Column 3:
armed_fraction_montreal— equilibrium gun ownership rate in the empirical Montreal gang network; unitless proportion in the range [0, 1]
This file is used for the comparison of gun ownership rates in simulated and real networks shown in Figure 3.
rowT00_b000_it00.txt
Text file containing a time series of gun ownership in a star-graph simulation.
- Column 1:
time_step— simulation time step (update step in the model); unit: simulation step - Column 2:
armed_fraction— fraction of individuals who are armed at that time step; unitless proportion in the range [0, 1]
This file is used to generate the time-evolution plot for gun ownership on a star graph shown in Figure S4.
snapshotbeta10.txt
Text file containing a spatial snapshot of individual arming states on a square lattice.
- Column 1:
x_index— x-coordinate of a lattice site; unit: lattice index - Column 2:
y_index— y-coordinate of a lattice site; unit: lattice index - Column 3:
state— arming state or strategy code of the individual at that lattice site; categorical code- Coding legend:
0 = unarmed,1 = armed
- Coding legend:
This file is used to generate the spatial configuration shown in Figure 2B.
vonNeunambeta10.xlsx
Excel file comparing simulated and theoretical equilibrium gun ownership rates in a lattice population using a von Neumann neighborhood.
- Column 1:
provocation_probability_sim— probability of provocation associated with the simulation results; unitless probability in the range [0, 1] - Column 2:
armed_fraction_sim— simulated equilibrium gun ownership rate; unitless proportion in the range [0, 1] - Column 3:
provocation_probability_theory— probability of provocation associated with the theoretical prediction; unitless probability in the range [0, 1] - Column 4:
armed_fraction_theory— theoretically predicted equilibrium gun ownership rate; unitless proportion in the range [0, 1]
This file is used to generate the comparison between simulation and theory shown in Figure 2A.
3. Real-network simulation archive
- Archive:
realnetworksimulations.zip - Description: Compressed archive containing the C++ simulation code and the anonymized real social network data used in the manuscript.
- Action required: This archive must be unzipped before running the simulations or accessing the network data.
After unzipping realnetworksimulations.zip, the archive contains:
- Directory:
realnetworksimulations/- Description: C++ code used to simulate gun adoption dynamics on real social networks.
- Directory:
realnetworksimulations/gangnetworkdata/- Description: Anonymized and coded real social network data files used in the simulations.
Data Accessibility and Organization
The Mathematica notebook depends on precomputed data files and does not regenerate all results from scratch internally. To reproduce the figures successfully, users should preserve the original relative file structure after unzipping the archives.
Instructions for Use
To reproduce figures
- Unzip
mathematica.zip. - Open
gitResults.nbin Wolfram Mathematica. - Ensure that the files in
mathematica/remain in their original relative location. - Evaluate the notebook to reproduce the main and supplementary figures.
To run the real-network simulations
- Unzip
realnetworksimulations.zip. - Navigate to the
realnetworksimulations/directory. - Compile the relevant C++ source files using a standard C++ compiler.
- Run the simulations as described in the source code and directory contents.
Notes
- The
.xlsxand.txtfiles inmathematica/are supporting data files used to recreate figures and summarized outputs. - The real-network data are anonymized and coded for research reproducibility.
- File names reflect simulation settings, parameter choices, or analysis types used in the study.
Contact
For questions regarding the code, data, or reproducibility of the results, please contact the authors of the manuscript.
