Hostname: page-component-5d59c44645-7l5rh Total loading time: 0 Render date: 2024-02-23T04:45:52.461Z Has data issue: false hasContentIssue false

Linear work generation of R-MAT graphs

Published online by Cambridge University Press:  29 May 2020

Lorenz Hübschle-Schneider
Karlsruhe Institute of Technology, 76128 Karlsruhe, Germany (e-mail:
Peter Sanders*
Karlsruhe Institute of Technology, 76128 Karlsruhe, Germany (e-mail:
*Corresponding author. Email:
Rights & Permissions [Opens in a new window]


Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

R-MAT (for Recursive MATrix) is a simple, widely used model for generating graphs with a power law degree distribution, a small diameter, and communitys structure. It is particularly attractive for generating very large graphs because edges can be generated independently by an arbitrary number of processors. However, current R-MAT generators need time logarithmic in the number of nodes for generating an edge— constant time for generating one bit at a time for node IDs of the connected nodes. We achieve constant time per edge by precomputing pieces of node IDs of logarithmic length. Using an alias table data structure, these pieces can then be sampled in constant time. This simple technique leads to practical improvements by an order of magnitude. This further pushes the limits of attainable graph size and makes generation overhead negligible in most situations.

Research Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (, which permits unrestricted re-use, distribution, and reproduction in any medium, provided the original work is properly cited.
© The Author(s), 2020. Published by Cambridge University Press


Action Editor: Ulrik Brandes


Barabasi, A.-L., & Albert, R. (1999). Emergence of scaling in random networks. Science, 286(5439), 509512.CrossRefGoogle ScholarPubMed
Bläsius, T., Friedrich, T., Katzmann, M., Meyer, U., Penschuck, M., & Weyand, C. (2019). Efficiently generating geometric inhomogeneous and hyperbolic random graphs. In 27th European symposium on algorithms (ESA) (pp. 21:1–21:14).Google Scholar
Chakrabarti, D., Zhan, Y., & Faloutsos, C. (2004). R-MAT: A recursive model for graph mining. In SIAM conference on data mining (SDM) (pp. 442446). SIAM.CrossRefGoogle Scholar
Drobyshevskiy, M., & Turdakov, D. (2020). Random graph modeling. ACM Computing Surveys, 52(6), 131:1–131:36.Google Scholar
Funke, D., Lamm, S., Meyer, U., Penschuck, M., Sanders, P., Schulz, C., …, von Looz, M. (2019). Communication-free massively distributed graph generation. Journal of Parallel and Distributed Computing, 131, 200217.CrossRefGoogle Scholar
Goldenberg, A., Zheng, A. X, Fienberg, S. E., & Airoldi, E. M. (2010). A survey of statistical network models. Foundations and Trends in Machine Learning, 2(2), 129233.CrossRefGoogle Scholar
Hübschle-Schneider, L., & Sanders, P. (2019a). Linear work generation of R-MAT graphs. arXiv/CoRR,arXiv:1905.03525.CrossRefGoogle Scholar
Hübschle-Schneider, L., & Sanders, P. (2019b). Parallel weighted random sampling. In 27th European symposium on algorithms (ESA) (pp. 59:1–59:24). LIPIcs.Google Scholar
Krioukov, D., Papadopoulos, F., Kitsak, M., Vahdat, A., & Boguná, M. (2010). Hyperbolic geometry of complex networks. Physical Review E, 82(3), 036106-1-036106-18.CrossRefGoogle ScholarPubMed
Lancichinetti, A., Fortunato, S., & Radicchi, F. (2008). Benchmark graphs for testing community detection algorithms. Physical Review E, 78(4), 046110.CrossRefGoogle ScholarPubMed
Leskovec, J., Chakrabarti, D., Kleinberg, J., Faloutsos, C., & Ghahramani, Z. (2010). Kronecker graphs: An approach to modeling networks. Journal of Machine Learning Research, 11, 9851042.Google Scholar
Leskovec, J., & Faloutsos, C. (2007). Scalable modeling of real graphs using Kronecker multiplication. In 24th international conference on machine learning (ICML) (pp. 497504). ACM.CrossRefGoogle Scholar
Mahdian, M., & Xu, Y. (2007). Stochastic kronecker graphs. In 5th international workshop on algorithms and models for the web-graph (WAW) (pp. 179186). Springer.CrossRefGoogle Scholar
Moreno, S., Pfeiffer, J. J., & Neville, J. (2018). Scalable and exact sampling method for probabilistic generative graph models. Data Mining and Knowledge Discovery, 32(6), 15611596.CrossRefGoogle Scholar
Murphy, R. C., Wheeler, K. B., Barrett, B. W., & Ang, J. A. (2010). Introducing the Graph 500. Cray user’s group.Google Scholar
Penschuck, M., Brandes, U., Hamann, M., Lamm, S., Meyer, U., Safro, I., …, Schulz , C. (2020). Recent advances in scalable network generation. arXiv/CoRR,arXiv:2003.00736.Google Scholar
Sanders, P., & Schulz, C. (2016). Scalable generation of scale-free graphs. Information Processing Letters, 116(7), 489491.CrossRefGoogle Scholar
Staudt, C. L., Sazonovs, A., & Meyerhenke, H. (2016). NetworKit: A tool suite for large-scale complex network analysis. Network Science, 4(4), 508530.CrossRefGoogle Scholar
Vose, M. D. (1991). A linear algorithm for generating random numbers with a given distribution. IEEE Transactions on Software Engineering (TSE), 17(9), 972975.CrossRefGoogle Scholar
Walker, A. J. (1977). An efficient method for generating discrete random variables with general distributions. ACM Transactions on Mathematical Software (TOMS), 3(3), 253256.CrossRefGoogle Scholar
Watts, D. J., & Strogatz, S. H. (1998). Collective dynamics of ‘small-world’ networks. Nature, 393(6684), 440.CrossRefGoogle ScholarPubMed