networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersBackRef
is_eulerian(G)

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.

Graphs with isolated vertices (i.e. vertices with zero degree) are not considered to have Eulerian circuits. Therefore, if the graph is not connected (or not strongly connected, for directed graphs), this function returns False.

Parameters

G : NetworkX graph

A graph, either directed or undirected.

Returns True if and only if G is Eulerian.

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

If you prefer to allow graphs with isolated vertices to have Eulerian circuits, you can first remove such vertices and then call is_eulerian as below example shows.

>>> G = nx.Graph([(0, 1), (1, 2), (0, 2)])
... G.add_node(3)
... nx.is_eulerian(G) False
>>> G.remove_nodes_from(list(nx.isolates(G)))
... nx.is_eulerian(G) True
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.algorithms.euler.is_semieulerian networkx.algorithms.euler.has_eulerian_path networkx.algorithms.euler.is_eulerian networkx.algorithms.euler.eulerize networkx.algorithms.euler.eulerian_circuit

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /networkx/algorithms/euler.py#19
type: <class 'function'>
Commit: