匹配生长随机几何图模型

Clone this wiki locally

Despite some pioneering modelling approaches proposed for specific systems, whether there exists some general mechanisms that account for the origins of such scaling behaviours in different contexts, especially in socioeconomic systems, remains an open question.

the hyperbolic space model for construction of scale-free networks

Papadopoulos, F., Kitsak, M., Serrano, A., Boguna, M. & Krioukov, D. Popularity versus similarity in growing networks. Nature 489, 537–540 (2012).

the hidden geometry of complex networks

Brockmann, D. & Helbing, D. The hidden geometry of complex, network-driven contagion phenomena. Science 342, 1337–1342 (2013).

a spatial-constrained attachment (SCA) model

Zhang, Jiang; Xintong Li, Xinran Wang, Wen-Xu Wang, Lingfei Wu (2015). "Scaling behaviors in the growth of networked systems and their geometric origin". Scientific Reports 5: 9767. http://www.nature.com/articles/srep09767

Geometric graph

Geometric： Generators for geometric graphs.

• random_geometric_graph(n, radius[,]) Returns a random geometric graph in the unit cube.
• geographical_threshold_graph(n, theta[,]) Returns a geographical threshold graph.
• waxman_graph(n[,]) Return a Waxman random graph.
• navigable_small_world_graph(n[,]) Return a navigable small-world graph.
http://networkx.github.io/documentation/latest/_modules/networkx/generators/geometric.html#random_geometric_graph

``` random_geometric_graph(n, radius, dim=2, pos=None): """Returns a random geometric graph in the unit cube. The random geometric graph model places ``n`` nodes uniformly at random in the unit cube. Two nodes are joined by an edge if the Euclidean distance between the nodes is at most ``radius``.
```
```#---------------------------------------------------------------------------

Random Geometric Graphs
---------------------------------------------------------------------------

"""Returns a random geometric graph in the unit cube.

The random geometric graph model places ``n`` nodes uniformly at random in
the unit cube. Two nodes are joined by an edge if the Euclidean distance
between the nodes is at most ``radius``.

Parameters
----------
n : int
Number of nodes
Distance threshold value
dim : int, optional
Dimension of graph
pos : dict, optional
A dictionary keyed by node with node positions as values.

Returns
-------
Graph

Examples
--------
Create a random geometric graph on twenty nodes where nodes are joined by
an edge if their distance is at most 0.1::

>>> G = nx.random_geometric_graph(20, 0.1)

Notes
-----
This algorithm currently only supports Euclidean distance.

This uses an `O(n^2)` algorithm to build the graph.  A faster algorithm
is possible using k-d trees.

The ``pos`` keyword argument can be used to specify node positions so you
can create an arbitrary distribution and domain for positions.

For example, to use a 2D Gaussian distribution of node positions with mean
(0, 0) and standard deviation 2::

>>> import random
>>> n = 20
>>> p = {i: (random.gauss(0, 2), random.gauss(0, 2)) for i in range(n)}
>>> G = nx.random_geometric_graph(n, 0.2, pos=p)

References
----------
.. [1] Penrose, Mathew, Random Geometric Graphs,
Oxford Studies in Probability, 5, 2003.
"""
G=nx.Graph()
G.name="Random Geometric Graph"
if pos is None:
# random positions
for n in G:
G.node[n]['pos']=[random.random() for i in range(0,dim)]
else:
nx.set_node_attributes(G,'pos',pos)
# connect nodes within "radius" of each other
# n^2 algorithm, could use a k-d tree implementation
nodes = G.nodes(data=True)
while nodes:
u,du = nodes.pop()
pu = du['pos']
for v,dv in nodes:
pv = dv['pos']
d = sum(((a-b)**2 for a,b in zip(pu,pv)))