Graph generators¶
Atlas¶
Generators for the small graph atlas.
|
Returns graph number |
Returns the list of all graphs with up to seven nodes named in the Graph Atlas. |
Classic¶
Generators for some classic graphs.
The typical graph generator is called as follows:
>>> G = nx.complete_graph(100)
returning the complete graph on n nodes labeled 0, .., 99 as a simple graph. Except for empty_graph, all the generators in this module return a Graph class (i.e. a simple, undirected graph).
|
Returns the perfectly balanced |
|
Returns the Barbell Graph: two complete graphs connected by a path. |
|
Return the complete graph |
|
Returns the complete multipartite graph with the specified subset sizes. |
|
Returns the circular ladder graph \(CL_n\) of length n. |
|
Generates the circulant graph \(Ci_n(x_1, x_2, ..., x_m)\) with \(n\) vertices. |
|
Returns the cycle graph \(C_n\) of cyclically connected nodes. |
|
Returns the hierarchically constructed Dorogovtsev-Goltsev-Mendes graph. |
|
Returns the empty graph with n nodes and zero edges. |
|
Creates a full r-ary tree of n vertices. |
|
Returns the Ladder graph of length n. |
|
Returns the Lollipop Graph; |
|
Returns the Null graph with no nodes or edges. |
|
Returns the Path graph |
|
Return the star graph |
|
Return the Trivial graph with one node (with label 0) and no edges. |
|
Return the Turan Graph |
|
Return the wheel graph |
Expanders¶
Provides explicit constructions of expander graphs.
|
Returns the Margulis-Gabber-Galil undirected MultiGraph on |
|
Returns the chordal cycle graph on |
Lattice¶
Functions for generating grid graphs and lattices
The grid_2d_graph()
, triangular_lattice_graph()
, and
hexagonal_lattice_graph()
functions correspond to the three
regular tilings of the plane, the square, triangular, and hexagonal
tilings, respectively. grid_graph()
and hypercube_graph()
are similar for arbitrary dimensions. Useful relevant discussion can
be found about Triangular Tiling, and Square, Hex and Triangle Grids
|
Returns the two-dimensional grid graph. |
|
Returns the n-dimensional grid graph. |
|
Returns an |
Returns the n-dimensional hypercube graph. |
|
|
Returns the \(m\) by \(n\) triangular lattice graph. |
Small¶
Various small and named graphs, together with some compact generators.
|
Return the small graph described by graph_description. |
|
Return the cubic graph specified in LCF notation. |
|
Returns the Bull graph. |
|
Returns the Chvátal graph. |
|
Returns the 3-regular Platonic Cubical graph. |
|
Return the Desargues graph. |
|
Returns the Diamond graph. |
|
Return the Platonic Dodecahedral graph. |
|
Returns the Frucht Graph. |
|
Return the Heawood graph, a (3,6) cage. |
Return the Hoffman-Singleton Graph. |
|
|
Returns the House graph (square with triangle on top). |
|
Returns the House graph with a cross inside the house square. |
|
Returns the Platonic Icosahedral graph. |
|
Return the Krackhardt Kite Social Network. |
|
Returns the Moebius-Kantor graph. |
|
Returns the Platonic Octahedral graph. |
Return the Pappus graph. |
|
|
Returns the Petersen graph. |
|
Return a small maze with a cycle. |
|
Return the 3-regular Platonic Tetrahedral graph. |
|
Returns the skeleton of the truncated cube. |
|
Returns the skeleton of the truncated Platonic tetrahedron. |
|
Returns the Tutte graph. |
Random Graphs¶
Generators for random graphs.
|
Returns a \(G_{n,p}\) random graph, also known as an Erdős-Rényi graph or a binomial graph. |
|
Returns a \(G_{n,p}\) random graph, also known as an Erdős-Rényi graph or a binomial graph. |
|
Returns a \(G_{n,m}\) random graph. |
|
Returns a \(G_{n,m}\) random graph. |
|
Returns a \(G_{n,p}\) random graph, also known as an Erdős-Rényi graph or a binomial graph. |
|
Returns a \(G_{n,p}\) random graph, also known as an Erdős-Rényi graph or a binomial graph. |
|
Returns a Newman–Watts–Strogatz small-world graph. |
|
Returns a Watts–Strogatz small-world graph. |
|
Returns a connected Watts–Strogatz small-world graph. |
|
Returns a random \(d\)-regular graph on \(n\) nodes. |
|
Returns a random graph according to the Barabási–Albert preferential attachment model. |
|
Returns a random graph according to the dual Barabási–Albert preferential attachment model. |
|
Returns an extended Barabási–Albert model graph. |
|
Holme and Kim algorithm for growing graphs with powerlaw degree distribution and approximate average clustering. |
|
Returns an random graph based on the specified kernel. |
|
Returns a random lobster graph. |
|
Returns a random shell graph for the constructor given. |
|
Returns a tree with a power law degree distribution. |
|
Returns a degree sequence for a tree with a power law distribution. |
|
Returns an random graph based on the specified kernel. |
Duplication Divergence¶
Functions for generating graphs based on the “duplication” method.
These graph generators start with a small initial graph then duplicate nodes and (partially) duplicate their edges. These functions are generally inspired by biological networks.
|
Returns an undirected graph using the duplication-divergence model. |
|
Returns a random graph using the partial duplication model. |
Degree Sequence¶
Generate graphs with a given degree sequence or expected degree sequence.
|
Returns a random graph with the given degree sequence. |
|
Returns a directed_random graph with the given degree sequences. |
|
Returns a random graph with given expected degrees. |
|
Returns a simple graph with given degree sequence constructed using the Havel-Hakimi algorithm. |
|
Returns a directed graph with the given degree sequences. |
|
Make a tree for the given degree sequence. |
|
Returns a simple random graph with the given degree sequence. |
Random Clustered¶
Generate graphs with given degree and triangle sequence.
|
Generate a random graph with the given joint independent edge degree and triangle degree sequence. |
Directed¶
Generators for some directed graphs, including growing network (GN) graphs and scale-free graphs.
|
Returns the growing network (GN) digraph with |
|
Returns the growing network with redirection (GNR) digraph with |
|
Returns the growing network with copying (GNC) digraph with |
|
Returns a random |
|
Returns a scale-free directed graph. |
Geometric¶
Generators for geometric graphs.
|
Returns a random geometric graph in the unit cube of dimensions |
|
Returns a soft random geometric graph in the unit cube. |
|
Returns a geographical threshold graph. |
|
Returns a Waxman random graph. |
|
Returns a navigable small-world graph. |
|
Returns a thresholded random geometric graph in the unit cube. |
Line Graph¶
Functions for generating line graphs.
|
Returns the line graph of the graph or digraph |
Returns the inverse line graph of graph G. |
Ego Graph¶
Ego graph.
|
Returns induced subgraph of neighbors centered at node n within a given radius. |
Stochastic¶
Functions for generating stochastic graphs from a given weighted directed graph.
|
Returns a right-stochastic representation of directed graph |
Intersection¶
Generators for random intersection graphs.
|
Returns a uniform random intersection graph. |
|
Returns a intersection graph with randomly chosen attribute sets for each node that are of equal size (k). |
|
Returns a random intersection graph with independent probabilities for connections between node and attribute sets. |
Social Networks¶
Famous social networks.
Returns Zachary’s Karate Club graph. |
|
Returns Davis Southern women social network. |
|
Returns Florentine families graph. |
|
Returns coappearance network of characters in the novel Les Miserables. |
Community¶
Generators for classes of graphs used in studying social networks.
|
Returns a caveman graph of |
|
Returns a connected caveman graph of |
|
Returns a relaxed caveman graph. |
|
Returns the random partition graph with a partition of sizes. |
|
Returns the planted l-partition graph. |
|
Generate a Gaussian random partition graph. |
|
Defines a “ring of cliques” graph. |
|
Returns a stochastic block model graph. |
|
Generate a windmill graph. |
Spectral¶
Generates graphs with a given eigenvector structure
|
Returns a random simple graph with spectrum resembling that of |
Trees¶
Functions for generating trees.
|
Returns a uniformly random tree on |
|
Creates a directed prefix tree from the given list of iterables. |
Non Isomorphic Trees¶
Implementation of the Wright, Richmond, Odlyzko and McKay (WROM) algorithm for the enumeration of all non-isomorphic free trees of a given order. Rooted trees are represented by level sequences, i.e., lists in which the i-th element specifies the distance of vertex i to the root.
|
Returns a list of nonisomporphic trees |
Returns the number of nonisomorphic trees |
Triads¶
Functions that generate the triad graphs, that is, the possible digraphs on three nodes.
|
Returns the triad graph with the given name. |
Joint Degree Sequence¶
Generate graphs with a given joint degree
|
Checks whether the given joint degree dictionary is realizable as a simple graph. |
|
Generates a random simple graph with the given joint degree dictionary. |
Mycielski¶
Functions related to the Mycielski Operation and the Mycielskian family of graphs.
|
Returns the Mycielskian of a simple, undirected graph G |
Generator for the n_th Mycielski Graph. |