DOI: 10.1093/comnet/cnae002 ISSN: 2051-1329

Probabilistic k-swap method for uniform graph generation beyond the configuration model

Lionel Tabourier, Julien Karadayi
  • Applied Mathematics
  • Computational Mathematics
  • Control and Optimization
  • Management Science and Operations Research
  • Computer Networks and Communications


Generating graphs with realistic structural characteristics is an important challenge for complex networks analysis, as these graphs are the null models that allow to describe and understand the properties of real-world networks. However, the field lacks systematic means to generate samples of graphs with predefined structural properties, because it is difficult to devise a method that is both flexible and guarantees to get a uniform sample, that is where any graph of the target set has the same probability to be represented in the sample. In practice, it limits the experimental investigation to a handful of models, including the well-known Erdős–Rényi graphs or the configuration model. The aim of this paper is to provide such a method: we design and implement a Monte Carlo Markov Chain process which is both flexible and satisfies the uniformity condition. Its assumptions are that: (1) the graphs are simple, (2) their degree sequence is fixed and (3) the user has at least one graph of the set available. Within these limitations, we prove that it is possible to generate a uniform sample of any set of such graphs. We provide an implementation in python and extensive experiments to show that this method is practically operational in several relevant cases. We use it with five specific set of constraints and verify that the samples obtained are consistent with existing methods when such a method is available. In those cases, we report that state-of-the-art methods are usually faster, as our method favours versatility at the cost of a lower efficiency. Also, the implementation provided has been designed so that users may adapt it to relevant constraints for their own field of work.

More from our Archive