Package networkx :: Package generators :: Module directed
[hide private]
[frames] | no frames]

Module directed

source code

Generators for some directed graphs.

gn_graph: growing network gnc_graph: growing network with copying gnr_graph: growing network with redirection




Author: Aric Hagberg (hagberg@lanl.gov)

Functions [hide private]
 
gn_graph(n, kernel=<function <lambda> at 0x8498ca4>, seed=None)
Return the GN (growing network) digraph with n nodes.
source code
 
gnr_graph(n, p, seed=None)
Return the GNR (growing network with redirection) digraph with n nodes and redirection probability p.
source code
 
gnc_graph(n, seed=None)
Return the GNC (growing network with copying) digraph with n nodes.
source code
 
_test_suite() source code
Function Details [hide private]

gn_graph(n, kernel=<function <lambda> at 0x8498ca4>, seed=None)

source code 

Return the GN (growing network) digraph with n nodes.

The graph is built by adding nodes one at a time with a link to one previously added node. The target node for the link is chosen with probability based on degree. The default attachment kernel is a linear function of degree.

The graph is always a (directed) tree.

Example:

>>> D=gn_graph(10)       # the GN graph
>>> G=D.to_undirected()  # the undirected version

To specify an attachment kernel use the kernel keyword

>>> D=gn_graph(10,kernel=lambda x:x**1.5) # A_k=k^1.5

Reference:

@article{krapivsky-2001-organization,
title   = {Organization of Growing Random Networks},
author  = {P. L. Krapivsky and S. Redner},
journal = {Phys. Rev. E},
volume  = {63},
pages   = {066123},
year    = {2001},
}

gnr_graph(n, p, seed=None)

source code 

Return the GNR (growing network with redirection) digraph with n nodes and redirection probability p.

The 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 p the link is instead "redirected" to the successor node of the target. The graph is always a (directed) tree.

Example:

>>> D=gnr_graph(10,0.5)  # the GNR graph
>>> G=D.to_undirected()  # the undirected version

Reference:

@article{krapivsky-2001-organization,
title   = {Organization of Growing Random Networks},
author  = {P. L. Krapivsky and S. Redner},
journal = {Phys. Rev. E},
volume  = {63},
pages   = {066123},
year    = {2001},
}

gnc_graph(n, seed=None)

source code 

Return the GNC (growing network with copying) digraph with n nodes.

The graph is built by adding nodes one at a time with a links to one previously added node (chosen uniformly at random) and to all of that node's successors.

Reference:

@article{krapivsky-2005-network,
title   = {Network Growth by Copying},
author  = {P. L. Krapivsky and S. Redner},
journal = {Phys. Rev. E},
volume  = {71},
pages   = {036118},
year    = {2005},
}