rustworkx.generators.empty_graph#

empty_graph(n, multigraph=True, /)#

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

Parameters:

n (int) – The number of nodes to generate the graph with.

Returns:

The generated empty graph

Return type:

PyGraph

import rustworkx.generators
from rustworkx.visualization import mpl_draw

graph = rustworkx.generators.empty_graph(5)
mpl_draw(graph)
../_images/rustworkx.generators.empty_graph_0_0.png