Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Structural Preferential Attachment Simulation

Build Status DOI

Table of Contents

  1. About
  2. Quick Start
  3. Compilation 1. Using CMake 2. Using GCC
  4. Execution
  5. Output
  6. Papers
  7. Growth at the Level of Communities
  8. Growth Within Communities
  9. Hierarchical Growth


This is a C++ implementation of the stochastic growth process dubbed Structural Preferential Attachment (SPA). See our official website for more informations.

Quick Start


spa_networks uses features from C++11 and must therefore be compiled with gcc-4.6 or clang-3.7 (or a newer version).

Using CMake

Compiling with cmake should be straightforward:

cmake .

The available options for cmake are


OPTMEM_MODE favors a small memory footprint over speed.

HPC_MODE silences all output and compiles assertions out.

The options can be passed to the usual GUI or through the command line interface:


The build has been tested with cmake-2.8 and cmake-3.4, on OSx and GNU/Linux, with gcc and clang.

Using GCC

The explicit compilation call below should work on most *nix systems

g++ -o3 -W -Wall -Wextra -pedantic -std=c++0x  spa_main.cpp modular_structure.cpp spa_network.cpp subgraph.cpp spa_algorithm.cpp interface.cpp output_functions.cpp misc_functions.cpp includes/logger.cpp -lboost_program_options -o SPA

Compilations options can be manually adjusted in the src/config.h file.


Multiple parameters must be set for each simulation of the SPA process. These parameters can be passed through a configuration file

./spa_networks -c path/to/config/file.txt

Note that ./spa_networks -g generates an empty configuration file template. If boost::program_options is installed and properly linked to the binary, parameters will also be accepted directly from the command line. See

./spa_networks -h 

for more information about each flags.


The results of a simulation can be found in the directory from which spa_networks is called. This default behavior can be modified with the -B / --base_path= flag (by specifying a new absolute or relative path). Note that outputs are not computed unless specifically requested. So, for example, there won't be an edge list file, unless the user specifies a file name for the edge_list. e.g. --edge_list=TestEdgeList.txt.


More information about the SPA process can be found in the following papers.

Growth at the Level of Communities:

Growth Within Communities:

Hierarchical Growth: