This code is associated with the paper "How strategy environment and wealth shape altruistic behaviour: Cooperation rules affecting wealth distribution in dynamic networks".
This repository contains and all of the code and data required to reproduce the figures presented in: S Pathak, P Verma, SK Ram, S Sengupta, How strategy environment and wealth shape altruistic behaviour: Cooperation rules affecting wealth distribution in dynamic social networks, submitted for publication.
The code included comes in two types:
- Code for running numerical simulations and generating data (written in a mixture of Python and Matlab)
- Code for loading the numerical simulation data and plotting it to reproduce the figures as shown in the text (written in Python and Matlab)
The following description addresses these two steps separately.
For Figures 1C and supplementary movie, the figure and the movie are generated directly in Matlab, so no data storage is required for the above cases. For Figures 2-5, the data is generated by Matlab and Python code, which can be found in the directory "Codes-for-DataGeneration/". The code runs simulations and saves data specifically for each of these figures, and the data is stored in the same directory where the code runs.
Once the data is generated (or downloaded from the repository) for a figure that you're interested in generating, navigate to the directory "Data_and_FigureGenerationCodes/". There, Python or Matlab code can be found for automatic generation of each figure. For generating the figure of your choice, place the data file of the corresponding figure in the same directory where the code for generating that figure is placed. Run the corresponding code to generate the required figure.
Data corresponding to all of the figures in the manuscript can also be downloaded directly from the "Data_and_FigureGenerationCodes/" subdirectories here in the repository and plotted as described in the paragraph above without re-generating it via the python or Matlab code in "Codes-for-DataGeneration/".
- Spandan Pathak, Email: [email protected]
- Prateek Verma, Email: [email protected]
- Supratim Sengupta, Email: [email protected]