complement

complement(G)[source]

Returns the graph complement of G.

Parameters
Ggraph

A NetworkX graph

Returns
GCA new graph.

Notes

Note that complement does not create self-loops and also does not produce parallel edges for MultiGraphs.

Graph, node, and edge data are not propagated to the new graph.