Note

This is the documentation for the current state of the development branch of rustworkx. The documentation or APIs here can change prior to being released.

rustworkx.complement

complement(graph)[source]
complement(graph: PyDiGraph, /)
complement(graph: PyGraph, /)

Compute the complement of a graph.

Parameters:

graph – The graph to be used, can be either a PyGraph or PyDiGraph.

Returns:

The complement of the graph.

Return type:

PyGraph or PyDiGraph

Note

Parallel edges and self-loops are never created, even if the multigraph is set to True