Skip to main content
`Ctrl`+`K`

# eulerize

eulerize(G)

  Transforms a graph into an Eulerian graph.

  If `G` is Eulerian the result is `G` as a MultiGraph, otherwise the result is a smallest (in terms of the number of edges) multigraph whose underlying simple graph is `G`.

  Parameters:
    G NetworkX graph

      An undirected graph

  Returns:
    G NetworkX multigraph
  Raises:
    NetworkXError

      If the graph is not connected.

  See also

  `is_eulerian`
  `eulerian_circuit`

  References

  [1]

  J. Edmonds, E. L. Johnson. Matching, Euler tours and the Chinese postman. Mathematical programming, Volume 5, Issue 1 (1973), 111-114.

  [2]

  https://en.wikipedia.org/wiki/Eulerian_path

  [3]

  http://web.math.princeton.edu/math_alive/5/Notes1.pdf

  Examples

      >>> G = nx.complete_graph(10)
      >>> H = nx.eulerize(G)
      >>> nx.is_eulerian(H)
      True