Home | Trees | Index | Help |
|
---|
Package NX :: Package generators :: Module degree_seq |
|
Generate graphs with a given degree sequence.
Function Summary | |
---|---|
Return a pseudograph with given degree sequence. | |
Attempt to create a valid degree sequence of length n using specified function sfunction(n,kwds). | |
Return a simple graph with given degree sequence, constructed using the Havel-Hakimi algorithm. | |
Return True if deg_sequence is a valid sequence of integer degrees equal to the degree sequence of some simple graph. |
Variable Summary | |
---|---|
str |
__author__ = 'Aric Hagberg (hagberg@lanl.gov)\nPieter Sw...
|
str |
__credits__ = ''
|
str |
__date__ = '$Date: 2005/03/30 23:56:28 $'
|
str |
__revision__ = '$Revision: 1.42 $'
|
Function Details |
---|
configuration_model(deg_sequence, seed=None)Return a pseudograph with given degree sequence.
As described by Newman [newman-2003-structure]. Nodes are labeled 1,.., len(deg_sequence), corresponding to their position in deg_sequence. This process can lead to duplicate edges and loops, and therefore returns a pseudograph type. You can call remove_parallel() and remove_selfloops() to get a simple graph (but likely without the exact specified degree sequence). This "finite-size effect" decreases as the size of the graph increases. References: [newman-2003-structure] M.E.J. Newman, "The structure and function of complex networks", SIAM REVIEW 45-2, pp 167-256, 2003. |
create_degree_sequence(n, sfunction=None, max_tries=50, **kwds)Attempt to create a valid degree sequence of length n using specified function sfunction(n,kwds). Repeatedly create a degree sequence by calling sfunction(n,kwds) until achieving a valid degree sequence. If unsuccessful after max_tries attempts, raise an exception. For examples of sfunctions that return sequences of random numbers, see NX.Utils. >>> from NX.utils import * >>> seq=create_degree_sequence(10,uniform_sequence) |
havel_hakimi_graph(deg_sequence, seed=None)Return a simple graph with given degree sequence, constructed using the Havel-Hakimi algorithm.
The Havel-Hakimi algorithm constructs a simple graph by successively connecting the node of highest degree to other nodes of highest degree, resorting remaining nodes by degree, and repeating the process. The resulting graph has a high degree-associativity. Nodes are labeled 1,.., len(deg_sequence), corresponding to their position in deg_sequence. See Theorem 1.4 in [chartrand-graphs-1996]. This algorithm is also used in the function is_valid_degree_sequence. References:
|
is_valid_degree_sequence(deg_sequence)Return True if deg_sequence is a valid sequence of integer degrees equal to the degree sequence of some simple graph.
See Theorem 1.4 in [chartrand-graphs-1996]. This algorithm is also used in havel_hakimi_graph() References:
|
Variable Details |
---|
__author__
|
__credits__
|
__date__
|
__revision__
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Mon Apr 11 10:59:20 2005 | http://epydoc.sf.net |