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
GNetworkX graph

A graph, either directed or undirected.

Notes

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

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