Macaulay2 » Documentation
Packages » Graphs :: hasEulerianTrail
next | previous | forward | backward | up | index | toc

hasEulerianTrail -- determines whether a graph or a digraph has an Eulerian trail

Description

A graph has an Eulerian trail if there is a path in the graph that visits each edge exactly once. A digraph has a Eulerian trail if there is a directed path in the graph that visits each edge exactly once. An Eulerian trail is also called an Eulerian path. Unconnected graphs can have a Eulerian trail, but all vertices of degree greater than 0 of a graph (or all vertices of degree greater than 0 in the underlying graph of a digraph) must belong to a single connected component.

i1 : G = cycleGraph 5;
i2 : hasEulerianTrail G

o2 = true
i3 : D = digraph(toList(1..4), {{1,2},{2,3},{3,4}});
i4 : hasEulerianTrail D

o4 = true

See also

Ways to use hasEulerianTrail:

  • hasEulerianTrail(Digraph)
  • hasEulerianTrail(Graph)

For the programmer

The object hasEulerianTrail is a method function.


The source of this document is in /build/reproducible-path/macaulay2-1.25.05+ds/M2/Macaulay2/packages/Graphs.m2:4230:0.