NetworkX

Previous topic

networkx.algorithms.operators.compose

Next topic

networkx.algorithms.operators.union

networkx.algorithms.operators.complement

networkx.algorithms.operators.complement(G, create_using=None, name=None)

Return graph complement of G.

Parameters :

G : graph

A NetworkX graph

create_using : NetworkX graph

Use specified graph for result. Otherwise a new graph is created.

name : string

Specify name for 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.