This documents the development version of NetworkX. Documentation for the current release can be found here.
gnr_graph(n, p, create_using=None, seed=None)¶
Returns the growing network with redirection (GNR) digraph with
nnodes and redirection probability
The GNR graph is built by adding nodes one at a time with a link to one previously added node. The previous target node is chosen uniformly at random. With probabiliy
pthe link is instead “redirected” to the successor node of the target.
The graph is always a (directed) tree.
The number of nodes for the generated graph.
The redirection probability.
- create_usingNetworkX graph constructor, optional (default DiGraph)
Graph type to create. If graph instance, then cleared before populated.
- seedinteger, random_state, or None (default)
Indicator of random number generation state. See Randomness.
P. L. Krapivsky and S. Redner, Organization of Growing Random Networks, Phys. Rev. E, 63, 066123, 2001.
To create the undirected GNR graph, use the
>>> D = nx.gnr_graph(10, 0.5) # the GNR graph >>> G = D.to_undirected() # the undirected version