geographical_threshold_graph¶
-
geographical_threshold_graph
(n, theta, alpha=2, dim=2, pos=None, weight=None)[source]¶ Returns a geographical threshold graph.
The geographical threshold graph model places
n
nodes uniformly at random in a rectangular domain. Each node \(u\) is assigned a weight \(w_u\). Two nodes \(u\) and \(v\) are joined by an edge if\[w_u + w_v \ge \theta r^{\alpha}\]where \(r\) is the Euclidean distance between \(u\) and \(v\), and \(\theta\), \(\alpha\) are parameters.
Parameters: Returns: Return type: Examples
>>> G = nx.geographical_threshold_graph(20, 50)
Notes
If weights are not specified they are assigned to nodes by drawing randomly from the exponential distribution with rate parameter \(\lambda=1\). To specify weights from a different distribution, use the
weight
keyword argument:>>> import random >>> n = 20 >>> w = {i: random.expovariate(5.0) for i in range(n)} >>> G = nx.geographical_threshold_graph(20, 50, weight=w)
If node positions are not specified they are randomly assigned from the uniform distribution.
References
[1] Masuda, N., Miwa, H., Konno, N.: Geographical threshold graphs with small-world and scale-free properties. Physical Review E 71, 036108 (2005) [2] Milan Bradonjić, Aric Hagberg and Allon G. Percus, Giant component and connectivity in geographical threshold graphs, in Algorithms and Models for the Web-Graph (WAW 2007), Antony Bonato and Fan Chung (Eds), pp. 209–216, 2007