Generators#

rustworkx.generators.cycle_graph([...])

Generate an undirected cycle graph

rustworkx.generators.directed_cycle_graph([...])

Generate a directed cycle graph

rustworkx.generators.path_graph([num_nodes, ...])

Generate an undirected path graph

rustworkx.generators.directed_path_graph([...])

Generate a directed path graph

rustworkx.generators.star_graph([num_nodes, ...])

Generate an undirected star graph

rustworkx.generators.directed_star_graph([...])

Generate a directed star graph

rustworkx.generators.mesh_graph([num_nodes, ...])

Generate an undirected mesh (complete) graph where every node is connected to every other

rustworkx.generators.directed_mesh_graph([...])

Generate a directed mesh (complete) graph where every node is connected to every other

rustworkx.generators.grid_graph([rows, ...])

Generate an undirected grid graph.

rustworkx.generators.directed_grid_graph([...])

Generate a directed grid graph.

rustworkx.generators.binomial_tree_graph(order)

Generate an undirected binomial tree of order n recursively.

rustworkx.generators.directed_binomial_tree_graph(order)

Generate a directed binomial tree of order n recursively.

rustworkx.generators.hexagonal_lattice_graph(...)

Generate an undirected hexagonal lattice graph.

rustworkx.generators.directed_hexagonal_lattice_graph(...)

Generate a directed hexagonal lattice graph.

rustworkx.generators.heavy_square_graph(d[, ...])

Generate an undirected heavy square graph.

rustworkx.generators.directed_heavy_square_graph(d)

Generate an directed heavy square graph.

rustworkx.generators.heavy_hex_graph(d[, ...])

Generate an undirected heavy hex graph.

rustworkx.generators.directed_heavy_hex_graph(d)

Generate a directed heavy hex graph.

rustworkx.generators.lollipop_graph([...])

Generate an undirected lollipop graph where a mesh (complete) graph is connected to a path.

rustworkx.generators.generalized_petersen_graph(n, k)

Generate a generalized Petersen graph \(G(n, k)\) with \(2n\) nodes and \(3n\) edges.

rustworkx.generators.barbell_graph([...])

Generate an undirected barbell graph where two identical complete graphs are connected by a path.

rustworkx.generators.full_rary_tree(...[, ...])

Creates a full r-ary tree of n nodes.

rustworkx.generators.empty_graph(n[, multigraph])

Generate an undirected empty graph with n nodes and no edges.

rustworkx.generators.directed_empty_graph(n)

Generate a directed empty graph with n nodes and no edges.

rustworkx.generators.complete_graph([...])

Generate an undirected complete graph with n nodes.

rustworkx.generators.directed_complete_graph([...])

Generate a directed complete graph with n nodes.

rustworkx.generators.dorogovtsev_goltsev_mendes_graph(n)

Generate a Dorogovtsev-Goltsev-Mendes graph.