Warning

This documents an unmaintained version of NetworkX. Please upgrade to a maintained version and see the current NetworkX documentation.

networkx.classes.function.is_empty

is_empty(G)[source]

Returns True if G has no edges.

Parameters

G (graph) – A NetworkX graph.

Returns

True if G has no edges, and False otherwise.

Return type

bool

Notes

An empty graph can have nodes but not edges. The empty graph with zero nodes is known as the null graph. This is an \(O(n)\) operation where n is the number of nodes in the graph.