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 |
The object hasEulerianTrail is a method function.