NetworkX

Previous topic

tensor_product

Next topic

compose

complement

complement(G, name=None)[source]

Return the graph complement of G.

Parameters :

G : graph

A NetworkX graph

name : string

Specify name for new graph

Returns :

GC : A 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.