networkx 2.8.2 Pypi GitHub Homepage
Other Docs
NotesParametersRaisesReturnsBackRef
eulerian_circuit(G, source=None, keys=False)

An Eulerian circuit is a closed walk that includes each edge of a graph exactly once.

Notes

This is a linear time implementation of an algorithm adapted from .

For general information about Euler tours, see .

Parameters

G : NetworkX graph

A graph, either directed or undirected.

source : node, optional

Starting node for circuit.

keys : bool

If False, edges generated by this function will be of the form (u, v) . Otherwise, edges will be of the form (u, v, k) . This option is ignored unless G is a multigraph.

Raises

NetworkXError

If the graph is not Eulerian.

Returns

edges : iterator

An iterator over edges in the Eulerian circuit.

Returns an iterator over the edges of an Eulerian circuit in G.

See Also

is_eulerian

Examples

>>> G = nx.complete_graph(3)
>>> list(nx.eulerian_circuit(G))
[(0, 2), (2, 1), (1, 0)]
>>> list(nx.eulerian_circuit(G, source=1))
[(1, 2), (2, 0), (0, 1)]
>>> [u for u, v in nx.eulerian_circuit(G)]
[0, 2, 1]
See :

Back References

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

networkx.algorithms.euler.eulerize

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#154
type: <class 'function'>
Commit: