{'fraction_non_alphanumeric': 0.04150303463048911, 'fraction_numerical': 0.010888968225633702, 'mean_word_length': 4.376679462571977, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Hyperbolic Graph Generator

Networks representing many complex systems in nature and society share some common structural properties like heterogeneous degree distributions and strong clustering. Recent research on network geometry has shown that those real networks can be adequately modeled as random geometric graphs in hyperbolic spaces. In this paper, we present a computer program to generate such graphs. Besides real-world-like networks, the program can generate random graphs from other well-known graph ensembles, such as the soft configuration model, random geometric graphs on a circle, or Erd\H{o}s-R\'enyi random graphs. The simulations show a good match between the expected values of different network structural properties and the corresponding empirical values measured in generated graphs, confirming the accurate behavior of the program.


Introduction
The interactions between components of a complex system are often represented as a network. This modeling allows for rigorous mathematical treatment, and broadens our understanding of the system [1]. Many real networks possess common structural patterns, including, in the first place, heterogeneous (often power-law) distributions of node degrees [2], and strong clustering, i.e., higher numbers of triangular subgraphs than predicted by classical random graph models [3]. Recently introduced geometric graph models, based on the assumption that nodes in real networks are embedded in latent hyperbolic spaces [4,5], reproduce these common structural properties of real networks. Furthermore, these hyperbolic graphs replicate dynamical processes on top of real networks [6] and accurately predict missing links in them [7].
In this work we present a program to generate random hyperbolic graphs. This software implements  Table 1: Regimes in the model. and extends the network model introduced in [4]. Nodes are randomly sprinkled on a hyperbolic disk, and the probability of the existence of an edge (the connection probability) between two nodes is a function of the distance between the nodes in the hyperbolic space. Thus generated graphs have strong clustering, and node degree distributions in them are power laws. Moreover, other popular and wellstudied random graph ensembles, namely the soft configuration model (SCM) [8], (soft) random geometric graphs (RGGs) on a circle [9,10], and Erdős-Rényi (ER) random graphs [11], appear as degenerate regimes in the model. Table 1 shows all the model regimes, the total of six. Each regime is defined by the values of only two parameters: γ, which is the expected exponent of the power-law degree distribution, and temperature T , the parameter controlling the strength of clustering in the network. Researchers in different disciplines may benefit from the use of random hyperbolic graphs in their work. Yet the full implementation of the model and all its regimes is a tricky business, which involves dealing with some delicate details, due to a variety of internal parameters and their interactions over the six regimes. In Sections 2-4 we describe the implementation details of the model, including how all the parameters are calculated in each regime. A good match between the values of expected graph properties and their observed values in generated graphs is confirmed in Section 5.

Input parameters
The program input parameters are the number of nodes N , the target expected average degreek of the network, the target expected power-law exponent γ of the degree distribution, and temperature T . The combination of γ and T values will define the graph ensemble from which generated networks are sampled ( Table 1).
Given the input parameters, the graph generation process consists of three steps: 1. Compute the internal parameters, such as the radius R of the hyperbolic disk occupied by nodes, as functions of the input parameter values, Sections 3, 4. 2. Assign to all nodes their angular and radial coordinates on the hyperbolic plane, Section 2.2. 3. Connect each node pair by an edge with probability (the connection probability), which is a function of the coordinates of the two nodes, Sections 3, 4.

Coordinate sampling
The assignment of node coordinates is done as follows in all the six regimes.
Radial coordinates r ∈ [0, R], where R is the radius of the hyperbolic disk, are sampled from the following distribution, which is nearly exponential with exponent α > 0, The calculation of internal parameter R is described in detail below; it is different in different regimes.
Internal parameter α depends on the expected exponent γ of the power distribution P (k) ∼ k −γ of nodes degrees k in generated graphs, and on the curvature of the hyperbolic space ζ = √ −K, which is set to ζ = 1 by default. For temperatures T ≤ 1, this relationship is given by while for T > 1 it becomes To sample radial coordinates r according to the distribution in Eq. (1), the inverse transform sampling is used: first a random value U i is sampled from the uniform distribution on [0, 1], and then the radial coordinate of node i is set to 3. Regimes with finite γ ≥ 2 3.1. T ∈ (0, ∞): Soft hyperbolic random geometric graphs This is the most general regime in the model, from which all other regimes can be obtained as limit cases. The connection probability in this case is where β = 1/T , and R is the radius of the hyperbolic disk occupied by nodes. The hyperbolic distance x between two nodes at polar coordinates (r, θ) and (r , θ ) is given by where ∆θ = π − |π − |θ − θ || is the angular distance between the nodes. To calculate the expected degree of a node at radial coordinate r, without loss of generality its angular coordinate can be set to zero, θ = 0, so that its expected degree can be written as The expected average degree in the network is then Given user-specified values of input parameters N , β = 1/T , ζ andk, the last equation is solved for R using the bisection method in combination with numeric evaluation of the integrals in the equation. The MISER Monte Carlo algorithm from the GSL library is used to compute the multidimensional integral in Eq. (8). The iterative bisection procedure to find R stops when the difference between the value of the computed integral in Eq. (8) and the target value of k is smaller than a threshold that is set to 10 −2 by default.

Limit T → 0: Hyperbolic random geometric graphs
In the T → 0 (β → ∞) limit, the connection probability in Eq. (5) becomes where Θ(x) is the Heaviside step function, meaning that two nodes are connected if the hyperbolic distance x between them is less than R, or they are not connected otherwise. The expected average degree in the network is given by the same Eq. (8), but with p(x) in the last equation. The value of R is determined using the same procedure as in Section 3.1.
The only difference is that function p(x) is given by Eq. (9).

Limit T → ∞: Soft configuration model
According to Eq. (3), in the T → ∞ limit with finite α, to have finite γ, curvature should also go to infinity, ζ → ∞, such that η = ζ/T is finite, and instead of Eq. (3) one gets More importantly, one can show that as a result of ζ → ∞, the expression for hyperbolic distance x between two nodes in Eq. (6) degenerates to meaning that in the T → ∞ regime the angular coordinates are completely ignored. The connection probability becomes and the expected average degree in the network is The value of R is determined using the same combination of the bisection method and numeric integration as in the previous section, except it is applied to Eq. (13).

Regimes with infinite γ → ∞
While in the T → ∞ limit the angular coordinates are ignored, in the γ → ∞ limit the radial coordinates are ignored. One can show this formally by observing that in this limit the radial node density approaches a delta function-all nodes are placed at the boundary at infinity of the hyperbolic plane, meaning that only angular coordinates determine distances between nodes.

T ∈ (0, ∞): Soft spherical random geometric graphs
In this most general case with infinite γ, one can show that the connection probability in Eq. (5) degenerates to where ∆θ = π − |π − |θ − θ || is the angular distance between the two nodes as before, while λ is a parameter controlling the average degreek in the network, analogous to R in the regimes with finite γ. Without loss of generality we can set θ = 0, so that the expression fork is where 2 F 1 is the Gauss hypergeometric function, and T = 1/β. In the special case with T = 1, the last expression simplifies tō If T = 1, the hypergeometric function in Eq. (15) cannot be evaluated using the GSL library, because the 2 F 1 evaluation in the library is implemented only for the case where the fourth argument of the function (−λ in Eq. (15)) is between −1 and 1, while for sufficiently large N/k, λ is always larger than 1 in Eq. (15). To avoid this difficulty, the following transformation is used [12]: If T > 1 is an integer, the second term in (17) diverges due to the sin function in the denominator, while the first term diverges because the third parameter of the 2 F 1 function is a non-positive integer. Hence, for integer values of temperature T > 1, their value is approximated by T + , where is set to 10 −6 by default. The error caused by this approximation is negligible. Equation (17) (or (16) if T = 1) is then numerically solved for λ using the bisection method, yielding the target value ofk in Eq. (15).

4.2.
Limit T → 0: Spherical random geometric graphs One can see from Eq. (17) that the solution for λ at small T 1 scales with N/k as λ = (N/k) β , β = 1/T . Therefore for β 1 the connection probability in Eq. (14) can be written as p(θ, θ ) = 1  which in the β → ∞ limit becomes meaning that two nodes are connected if the angular distance ∆θ between them is smaller than πk/N , or they are not connected otherwise. This connectivity threshold ensures that the expected average degree in the network isk.

Limit T → ∞: Erdős-Rényi graphs
In this most degenerate regime, both angular and radial coordinates are completely ignored. This regime is formally achieved by keeping both α and ζ finite while letting T → ∞. One can then show that the connection probability in Eq. (5) degenerates to which for sparse graphs withk N tends to p(x) =k/N , i.e., the connection probability in classical (Erdős-Rényi) random graphs. Tables 2a and 2b show, respectively, the average degree and clustering values in generated graphs for different regimes, 10 3 samples in each regime. All the regimes match the target average degreek = 10, although low values of γ lead to much higher fluctuations. For any γ > 2, average clustering decreases with temperature from a maximum at T = 0 to zero at T → ∞. Figure 1 shows the observed distribution of node degrees for three different values of γ. As expected, for finite γ, distributions follow a power-law P (k) ∼ k −γ . In the limit at γ → ∞ the observed degree distributions follow exactly the Poisson distribution with mean µ =k. Figure 2 shows clustering in generated graphs. For finite γ, low-degree nodes have stronger clustering than high-degree nodes. In the case of γ → ∞, all nodes have similar clustering values.