Skip to content

LevinaLab/spatial-branching-network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spatial Branching Network

The code in this repository implements a branching network with spatial connectivity to study the role of network strcuture on critical dynamics. Details are provived in the paper below. If you are using this code for a scientific publication, please cite the paper.

Zeraati*, R., Buendía*, V., Engel, T. A., & Levina, A. (2024). Topology-dependent coalescence controls scaling exponents in finite networks. Physical Review Research, 6(2), 023131. https://doi.org/10.1103/PhysRevResearch.6.023131

There are implementations both in C++ and in Python, each one in its respective folder, cpp and python. The C++ run faster, but lacks all the coalescence measurements. Code to replicate the figures of the paper is also included, but the data has to be generated by the user.

Running the Python code

The files avalanche_generator.py and lattice_activity.py contain the core functions to simulate the system and calculate the relevant observables. These can be invoked from the run_*.py files:

  • run_av.py generates avalanches.
  • run_pd.py runs an entire phase diagram.
  • run_singlepd.py is the same as the previous one, but it only computes the value for a single branching ratio. It is useful to paralellize the simulations in a cluster.
  • run_coalescence.py computes the amount of active units and uses them to measure the amount of coalescence.
  • run_br_adaptive.py simulates an adaptive branching process using the measured coalescence. In order to execute this file, run_coalescence.py must be invoked first.

Note that in the Python code, sigma refers to the branching parameter, which is called m in the paper.

Running the C++ code

The core functions are inside the lbnm.cpp file. In order to perform the simulations, there are several Python scripts that compile and execute automatically the C++ code, for ease of use. These are

  • run_avalanches.py generates avalanches.
  • run_phase_diagram.py generates a complete phase diagram. The launcher divides the work between the given amount of cores
  • run_phase_diagram_rewire.py generates a complete phase diagram for a network with rewired connections

Generating figures

The figures can be generated by generating the data first and then using the code provided in the Jupyter Notebooks. Note that the paths to the data folder must be changed to the ones selected by the user (inside the results folder).

About

Codes for a branching network with spatial connectivity

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published