rustworkx.generators.directed_mesh_graph#
- directed_mesh_graph(num_nodes=None, weights=None, multigraph=True)#
Generate a directed mesh (complete) graph where every node is connected to every other.
- Parameters:
num_nodes (int) – The number of nodes to generate the graph with. Node weights will be None if this is specified. If both
num_nodesandweightsare set, this will be ignored andweightswill be used.weights (Sequence[Any]) – A sequence of node weights, typically a list. If both
num_nodesandweightsare set, this will be ignored andweightswill be used.multigraph (bool) – When set to
Falsethe outputPyDiGraphobject will not be not be a multigraph and won’t allow parallel edges to be added. Instead calls which would create a parallel edge will update the existing edge.
- Returns:
The generated mesh graph
- Return type:
- Raises:
IndexError – If neither
num_nodesorweightsare specified
import rustworkx.generators from rustworkx.visualization import mpl_draw graph = rustworkx.generators.directed_mesh_graph(4) mpl_draw(graph)