generate_thresholded_geometric

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:
Nint

Number of vertices.

radiusfloat

Maximum distance of the connected pairs.

thetafloat

Threshold of the sum of the weights.

dimint (optional, default: 2)

Dimension of the space.

posnumpy.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.

Returns:
gGraph

The generated undirected graph.

posVertexPropertyMap

Positions of the vertices.

See also

geometric_graph

Geometric graph

generate_geographical_threshold

Geographical 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 radius and \(w_u + w_v \ge \theta\). The candidate pairs are found with geometric_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")
<...>
../_images/generate_thresholded_geometric-small.png

Thresholded random geometric graph with \(N=300\) vertices in the unit square, a radius of 0.1, and \(\theta=1\).#