Warning

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

networkx.algorithms.euler.is_eulerian

is_eulerian(G)[source]

Returns True if and only if G is Eulerian.

A graph is Eulerian if it has an Eulerian circuit. An Eulerian circuit is a closed walk that includes each edge of a graph exactly once.

Parameters:G (NetworkX graph) – A graph, either directed or undirected.

Examples

>>> nx.is_eulerian(nx.DiGraph({0: [3], 1: [2], 2: [3], 3: [0, 1]}))
True
>>> nx.is_eulerian(nx.complete_graph(5))
True
>>> nx.is_eulerian(nx.petersen_graph())
False

Notes

If the graph is not connected (or not strongly connected, for directed graphs), this function returns False.