Complex Networks related programs

This page contains some code for community detection and for some simple generators for complex networks. We assume that people using these codes already have a network library to deal with the generated networks.

We also encourage you to let us know if you use any of the following codes.

"Louvain method" for community detection - C++ and Matlab

Louvain method is a very fast and efficient method to partition a graph. The current C++ version is available on sourceforge.

We also propose a Matlab version of the code. Please be aware that I am not the developper of this version and that I cannot provide any help or assistance.

Multi-step Community detection

Multi-Step Comunity is community detection program written in C++ by Thomas Aynaud. It aims at finding communities with a high average modularity on evolving graphs. Source code can be downloaded here : source code.

Distribution generator

Here is a simple generator which can build some distributions with given properties : source code (compile with -lm)

Typical use might be:
./distributions -u -m 1 -M 10 -n 100 -s 500
Generates a distribution of 100 uniform random numbers between 1 and 10, such that the sum of numbers is 500.
./distributions -p -2.2 -m 1 -M 100 -n 200 -s 500
Same principle with 200 numbers between 1 and 100 following a power law with exponent -2.2.

If you plan to generate more complex distributions, we encourage you to visit There is no difficulties at interfacing our programs with this library which contains more generators and is more efficient.

Networks generators

Bipartite network generator

Source code

Generates a random bipartite network with prescribed degree distribution for both sets. Both distributions must be provided to the program and be consistent (number of top links=number of bottom links). Typical use of the generator (using distributions generator) might be:
./distributions -u -m 1 -M 10 -n 100 -s 500 > top_distrib
./distributions -p -2.2 -m 1 -M 100 -n 200 -s 500 > bottom_distrib
./random_bipartite -t top_distrib -b bottom_distrib > bn_test
Which generates a random bipartite network with a top uniform degree distribution and a bottom power law distribution.

As described in the paper Bipartite Graphs as Models of Complex Networks., this model is particularly well suited to the modeling of most complex network. In particular if one choose a top degree distribution to be a Poisson law, and the bottom one to be a power law, the generated network have a small average distance, a high clustering and a power law distribution of degrees.

Erdos-Renyi network generator

Source file

Generates a random Erdos-Renyi network, with either a given connection probability or a given number of links.

Configuration model network generator

Source file

Generates a random network with a prescribed degree distribution using the configuration model.

Albert-Barabasi network generator

Source file

Generates a random Albert-Barabasi network with a given core size and a given number of links per new node.