Skip to main content

Module generators

Module generators 

Source

Functionsยง

barabasi_albert
Barabasi-Albert preferential attachment graph. Start with m+1 fully connected nodes, then add n-(m+1) nodes, each connecting to m existing nodes with probability proportional to degree.
binary_tree
Complete binary tree of given depth (0 = just root).
complete_bipartite
Complete bipartite graph K_{m,n}.
complete_graph
Complete graph K_n: every pair of nodes connected.
cycle_graph
Cycle graph C_n.
erdos_renyi
Erdos-Renyi random graph G(n, p). Each possible edge exists independently with probability p.
grid_graph
Grid graph with given rows and cols.
path_graph
Path graph P_n.
petersen_graph
Petersen graph: 10 nodes, 15 edges.
star_graph
Star graph S_n: one center connected to n-1 leaves.
watts_strogatz
Watts-Strogatz small-world graph. Start with a ring lattice where each node connects to k nearest neighbors, then rewire each edge with probability beta.