Generators and datasets#

Classic and random graphs, example DAGs and bundled datasets (ag.gen).

Classic graphs#

empty_graph

n nodes and no edges.

path_graph

Path through 0, 1, …, n-1 in order (arcs i → i+1 when directed).

cycle_graph

Cycle through 0, 1, …, n-1 and back to 0 (arcs i → i+1 mod n when directed).

complete_graph

Complete graph K_n; directed, every ordered pair u ≠ v is an arc.

complete_bipartite_graph

Complete bipartite graph K_{n1,n2}.

star_graph

Star with center 0 and n leaves 1 … n (n + 1 nodes, like networkx).

wheel_graph

Wheel on n nodes: hub 0 joined to every node of the cycle 1 … n-1.

grid_graph

Two-dimensional rows × cols lattice with nodes (r, c).

hypercube_graph

d-dimensional hypercube Q_d: nodes 0 … 2^d - 1, edges between labels differing in one bit.

balanced_tree

Perfectly balanced r-ary tree of height h.

binomial_tree

Binomial tree of order k (2^k nodes, root 0).

ladder_graph

Ladder with n rungs: rails 0 … n-1 and n … 2n-1, rungs joining i and i+n.

circular_ladder_graph

Ladder whose two rails are closed into cycles (the prism graph C_n × K_2).

lollipop_graph

Complete graph K_m (nodes 0 … m-1) with a path of n nodes hanging from node m-1.

barbell_graph

Two K_{m1} bells joined by a path of m2 nodes (networkx numbering).

petersen_graph

The Petersen graph: 10 nodes, 15 edges, 3-regular, girth 5 (outer cycle 0–4, inner star 5–9).

complete_multipartite_graph

Complete multipartite graph with parts of the given sizes.

turan_graph

Turán graph T(n, r): complete r-partite graph with parts as equal as possible.

Random graphs#

erdos_renyi

G(n, p): every possible edge (arc, if directed) is present independently with probability p.

gnm_random_graph

G(n, m): a graph chosen uniformly among those with n nodes and exactly m edges.

barabasi_albert

Barabási–Albert preferential attachment.

watts_strogatz

Watts–Strogatz small world.

stochastic_block_model

Stochastic block model.

planted_partition

Planted partition: l groups of k nodes, linked with p_in inside a group and p_out across.

random_geometric

Random geometric graph in the unit square.

random_regular

Random d-regular simple graph on n nodes (argument order as in networkx).

random_tree

Uniformly random labeled tree on n >= 1 nodes (decoded from a random Prüfer sequence).

configuration_model

Simple-graph configuration model for the given degree sequence.

powerlaw_cluster

Holme–Kim model: preferential attachment plus triad formation.

random_dag

Random DAG: a random topological order, then only forward arcs.

layered_dag

Random layered DAG: arcs only between consecutive layers.

random_task_dag

Random project network of n tasks, ready for CPM/PERT and scheduling demos.

Example DAGs#

ml_pipeline

Machine-learning pipeline, 16 tasks: ingest → validate → features → train variants → evaluate → deploy.

software_build

Build graph of a client/server product, 20 targets from dependency fetch to release.

project_plan

Construction of a single-family house in 18 tasks, a classic CPM/PERT example.

data_warehouse_etl

Nightly data-warehouse ETL, 25 tasks with heavy fan-out (extracts) and fan-in (facts, aggregates).

course_prerequisites

Prerequisite structure of a computer-science degree, 22 courses.

Datasets#

les_miserables

Co-appearance network of the 77 characters of Les Misérables (254 edges).

florentine_families

Marriage alliances among 15 Renaissance Florentine families (20 edges).

davis_southern_women

Davis's Southern Women: 18 women × 14 social events, 89 attendances (bipartite).

ucalgary_campus

University of Calgary main campus: 56 buildings and the ways between them.