generate_thresholded_geometric#
- graph_tool.generation.generate_thresholded_geometric(N, radius, theta, dim=2, pos=None, weights=None)[git][source]#
Generate a thresholded random geometric graph.
- Parameters:
- N
int Number of vertices.
- radius
float Maximum distance of the connected pairs.
- theta
float Threshold of the sum of the weights.
- dim
int(optional, default:2) Dimension of the space.
- pos
numpy.ndarray(optional, default:None) Positions of the vertices, as an array of shape
(N, dim). If not given, they are uniformly distributed in the unit hypercube.- weightsiterable of
float(optional, default:None) Vertex weights. If not given, they are exponentially distributed with unit mean.
- N
- Returns:
- g
Graph The generated undirected graph.
- pos
VertexPropertyMap Positions of the vertices.
- g
See also
geometric_graphGeometric graph
generate_geographical_thresholdGeographical threshold graph
Notes
In the thresholded random geometric graph [masuda-geographical-2005], two vertices \(u\) and \(v\) are connected if their Euclidean distance is not larger than
radiusand \(w_u + w_v \ge \theta\). The candidate pairs are found withgeometric_graph().References
[masuda-geographical-2005]Naoki Masuda, Hiroyoshi Miwa and Norio Konno, “Geographical threshold graphs with small-world and scale-free properties”, Physical Review E 71, 036108 (2005), DOI: 10.1103/PhysRevE.71.036108 [sci-hub, @tor], arXiv: cond-mat/0409378
Examples
>>> g, pos = gt.generate_thresholded_geometric(1000, 0.1, 1) >>> print(g.num_edges()) 10731
A smaller instance is drawn as follows, with the vertices at their positions:
>>> g, pos = gt.generate_thresholded_geometric(300, 0.1, 1) >>> gt.graph_draw(g, pos=pos, ... output="generate_thresholded_geometric-small.pdf") <...>
Thresholded random geometric graph with \(N=300\) vertices in the unit square, a radius of 0.1, and \(\theta=1\).#