Note
This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.
rustworkx.hyperbolic_random_graph#
- hyperbolic_random_graph(pos, beta, r, /, seed=None)#
Return a hyperbolic random undirected graph (also called hyperbolic geometric graph).
The usual hyperbolic random graph model connects pairs of nodes with probability
\[P[(u,v) \in E] = \frac{1}{1+\exp(\beta(d(u,v) - R)/2)},\]a sigmoid function that decreases as the hyperbolic distance between nodes \(u\) and \(v\) increases. The hyperbolic distance is given by
\[d(u,v) = \text{arccosh}\left[x_0(u) x_0(v) - \sum_{j=1}^D x_j(u) x_j(v) \right],\]where \(D\) is the dimension of the hyperbolic space and \(x_d(u)\) is the \(d\) th-dimension coordinate of node \(u\) in the hyperboloid model. The number of nodes and the dimension are inferred from the coordinates
pos
. The 0-dimension “time” coordinate is inferred from the others.If
beta
isNone
, all pairs of nodes with a distance smaller thanr
are connected.This algorithm has a time complexity of \(O(n^2)\) for \(n\) nodes.
- Parameters:
pos (list[list[float]]) – Hyperboloid coordinates of the nodes [[\(x_1(1)\), …, \(x_D(1)\)], [\(x_1(2)\), …, \(x_D(2)\)], …]. The “time” coordinate \(x_0\) is inferred from the other coordinates.
beta (float) – Sigmoid sharpness (nonnegative) of the connection probability.
r (float) – Distance at which the connection probability is 0.5 for the probabilistic model. Threshold when
beta
isNone
.seed (int) – An optional seed to use for the random number generator.
- Returns:
A PyGraph object
- Return type: