Constant Amortized Time Enumeration of Eulerian trails
aa r X i v : . [ c s . D S ] J a n Constant Amortized Time Enumeration ofEulerian trails
Kazuhiro Kurita and Kunihiro Wasa National Institute of Informatics, Tokyo, Japan, [email protected] Toyohashi University of Technology, Aichi, Japan, [email protected]
Abstract
In this paper, we consider enumeration problems for edge-distinct andvertex-distinct Eulerian trails. Here, two Eulerian trails are edge-distinct if the edge sequences are not identical, and they are vertex-distinct if thevertex sequences are not identical. As the main result, we propose optimalenumeration algorithms for both problems, that is, these algorithm runsin O ( N ) total time, where N is the number of solutions. Our algorithmsare based on the reverse search technique introduced by [Avis and Fukuda,DAM 1996], and the push out amortization technique introduced by [Uno,WADS 2015]. Keywords—
Eulerian trail, Enumeration algorithm, Output-sensitive al-gorithm, Constant Amortized Time An Eulerian trail in a graph is a trail that visits all edges exactly once. Findinga Eulerian trail is a classical problem in graph theory. A famous Seven Bridgesof K¨onigsberg problem solved by Leonhard Euler in 1736 is one of a well-knownapplication. Eulerian trails have many other applications such as CMOS circuitdesign [5] bioinformatics [11, 12], and automaton theory [9].Deciding for the existence of a Eulerian trail can be done in time poly-nomial [8]. However, the counting problem of edge-distinct
Eulerian trails is P -complete [4] for general undirected graphs, although for directed graphs,Aardenne and Brujin [1] proposed the BEST algorithm whose running timeis polynomial time. Here, two Eulerian trails are edge-distinct if the edge se-quences of them are different. Similarly, two Eulerian trails are vertex-distinct ifthe vertex sequences of them are different. If a graph is simple, the set of edge-distinct Eulerian trails and that of vertex-distinct Eulerian trails are equivalent.Thus, counting Eulerian trails is intractable for general cases unless P = P .Recently, Conte et al. [6] give an algorithm that answers whether a graph con-tains at least z Eulerian trails in time polynomial in m and z , where m is thenumber of edges in the graph. 1n contrast to counting problems, enumeration problems ask to output all thesolutions without duplicates. Especially, enumeration problems for subgraphssatisfying some constraints have been widely studied, such as spanning trees [14], st -paths [3, 7], cycles [3], maximal cliques [16, 17], and many others [19]. In thispaper, we focus on enumeration problems for Eulerian trails. As mentioned inabove, because the counting version is intractable, the enumeration problem isalso intractable with respect to the size of inputs. Hence, in this paper, weaim to develop efficient enumeration algorithms with respect to the size of bothinputs and outputs . Such algorithms are called output-sensitive algorithms . Inparticular, an enumeration algorithm A runs in polynomial amortized time if thetotal running time of A is O ( poly ( n ) N ) time, where n is the size of inputs and N is the number of solutions. That is, A outputs solutions in O ( poly ( n )) time pereach on average. In this contexts, the ultimate goal is to develop O ( N ) timeenumeration algorithm, that is poly ( n ) ∈ O (1), and such optimal algorithmshave been obtained [13, 18]. Under this evaluation, Kikuchi [10] proposed an O ( mN ) time algorithm for simple general graphs, where m is the number ofedges in an input graph. However, the existence of a constant amortized timeenumeration algorithm for Eulerian trails is open.In this paper, we propose optimal enumeration algorithms for edge-distinctEulerian trails and vertex-distinct Eulerian trails based on the reverse searchtechnique [2]. Intuitively speaking, an enumeration algorithm based on thereverse search technique enumerates solutions by traversing on a tree-shapedsearch space, called the family tree . Each node on the tree corresponds to aprefix of a solution called a partial solution and each leaf corresponds to somesolution. The edge set of the tree is defined by the parent-child relation betweennodes. in particular, a partial solution P is the parent of a partial solution P ′ if P ′ is obtained by adding one edge to P . Although our algorithm is quitesimple, with a sophisticated analysis [18] and contracting operations for graphs,we achieve constant amortized time per solution. An undirected graph G = ( V, E ) is a pair of a vertex set V and an edge set E ⊆ V × V . Note that ( u, v ) ∈ E if and only if ( v, u ) ∈ E for each pairof vertices u, v . Graphs may contain self loops and parallel edges. For eachvertex v , the neighborhood N ( v, µ v ) is a multiset of the underlying set N ( v ),where N ( v ) is the set of vertices adjacent to v and µ v : N ( v ) → N + is afunction from N ( v ) to a positive integer. That is, µ v ( u ) represents the numberof distinct edges ( v, u ) in a graph. The degree d ( v ) of a vertex v is defined as d ( v ) = | N ( v, µ v ) | = P u ∈ N ( v ) µ v ( u ). A vertex v is pendant if d ( v ) = 1. Let ∂ G ( v ) be the set of edges incident to v .A sequence π = ( v , e , v , e , . . . , v ℓ ) is a trail if for each i = 1 , . . . , ℓ − e i = ( v i , v i +1 ) and edges in π are mutually distinct. Note that some vertexappears more than once in a trail. In particular, a trail π is a path if v i = v j in π for i = j . A circuit is a trail such that the first vertex and the last vertexare equal. A trail π is an Eulerian trail if π contains all the edges in G . G is Eulerian if G has at least one Eulerian trail. It is known that G is Eulerian ifand only if either every vertex has even degree or exactly two vertices have odddegree. In what follows, we assume that input graphs are Eulerian. We define2 ( π ) = ( e , . . . , e ℓ − ) as a subsequence of π containing all the edges in π , andsimilarly, V ( π ) = ( v , . . . , v ℓ ) as a subsequence of π containing all the verticesin π . Let π and π be two Eulerian trails. We say π is edge-distinct from π if E ( π ) = E ( π ) and we say π is vertex-distinct from π if V ( π ) = V ( π ). Asequence π ′ is a prefix of π if π ′ = ( v , e , v , e , . . . , v ℓ ′ ) for some 1 ≤ ℓ ′ ≤ ℓ .Assume that every Eulerian trail starts from s and ends with t . A trail P is a partial Eulerian trail in G if P starts from s and there is an Eulerian trailthat contains P as a prefix. Especially, if E ( G ) \ P = ∅ , then P is called a proper partial Eulerian trail . An edge e is said to be addible if P + e is also apartial Eulerian trail. We denote by t ( P ) the end vertex of a partial Euleriantrail P such that t ( P ) = s . For each partial Eulerian trail P , we denote by P G := ( V ′ , E ( G ) \ P ) such that a vertex v is contained in V ′ if there is an edgein E ( G ) \ P such that v is incident to it. That is, P G is the set of edges which wehave to add to P for constructing a solution. Now, we formalize our problemsas follows. Problem 1 (Edge-distinct Eulerian trail enumeration) . Given a graph G , out-put all the edge-distinct Eulerian trails in G without duplicate. Problem 2 (Vertex-distinct Eulerian trail enumeration) . Given a graph G ,output all the vertex-distinct Eulerian trails in G without duplicate. In this section, we propose our enumeration algorithm for edge-distinct Euleriantrails based on the reverse search technique proposed by Avis and Fukuda [2].We remark that Eulerian trails in this section are considered as a sequence ofedges. We enumerate solutions by traversing a directed rooted tree, called a family tree T . The tree consists of nodes P and edges E . Each node X in P is associated with a partial Eulerian trail P and a graph G . Let P ( X ) bethe associated partial Eulerian trail of X . If no confusion arises, we identify anode with its associated a partial Eulerian trail. The root of T is the trail R consisting of s . For two partial Eulerian trails P and P , there is a directededge ( P , P ) in E if P ⊂ P and | P \ P | = 1. We say that P is the parent of P and P is a child of P . Note that a partial Euler path may have more thanone children. Let C ( P ) be the set of child partial Eulerian trails of P . From thedefinition of the parent-child relation, for any partial Eulerian trail P , there is aunique path from P to the root on T obtained by recursively removing an edge( u, t ( P )) in P . Hence, for any node P in T , there is a path from R to P in T .Let Γ G ( P ) := ∂ G ( t ( P )) ∩ P G be the candidates of addible edges e to P without violating the parent-child relation. To traverse all the children of apartial Eulerian trail P , generating partial Eulerian trails P + e is enough if e ∈ Γ G ( P ) satisfies the condition given in the next lemma. Lemma 3.
Let P be a partial Eulerian trail in G and e be an edge in P G . Then, P + e is a child of P if and only if Γ G ( P ) = { e } or e ∈ Γ G ( P ) is not a bridge.Proof. Suppose that P + e is a child of P . Assume that | Γ G ( P ) | > e is abridge. This implies that G − ( P + e ) is disconnected, and thus, this contradictsthe assumption that P + e is a partial Eulerian trail.3 lgorithm 1: Proposed enumeration algorithm for Eulerian trails R ← the root partial Eulerian trail; Compute R G from G ; foreach edge e ∈ ∂ G ( s ) do if e is not a bridge in G then GenChild(
R, e ) ; Function
GenChild( P ′ , f ) :Input: Partial Eulerian trail P ′ , edge f P ← P ′ + f ; Compute P G from P ′ G ; if P G = ∅ then Output P ; else Find bridges in P G by Tarjan’s algorithm; foreach edge e ∈ ∂ G ( t ( P )) ∩ P G do if Γ G ( P ) = { e } or e is not a bridge then GenChild( P , e ) ;If Γ G ( P ) contains exactly one edge, then the lemma clearly holds. Supposethat | Γ G ( P ) | >
1. From the definition of a partial Eulerian trail, Γ G ( P ) containsat most one bridge. Hence, Γ G ( P ) contains a non-bridge edge.Now, we give our proposed enumeration algorithm as follows. The algorithmstarts with the root partial Eulerian trail R . Then, for each edge e = ( s, u ) inΓ G ( R ), the algorithm generates a child partial Eulerian trail ( e ) of R if e meetsthe condition by Lemma 3. The algorithm recursively generates descendantnodes of R by adding edges in the candidate set by depth-first traversal on T . If the algorithm finds an Eulerian trail, then the algorithm outputs it as asolution. The correctness of the algorithm is clear from the construction. Hence,we obtain the next theorem. Theorem 4.
Algorithm 1 outputs all the edge-distinct Eulerian trails in a givengraph once and only once.
The goal of this section is to develop an optimal enumeration algorithm con-stant amortized time per solution based on the algorithm given in the previoussection. We summarize our algorithm in Algorithm 1. We first consider thetime complexity for generating all the children of a partial Eulerian trail P .Let m P = | P G | . Finding all bridges in P G consumes O ( m P ) time by Tarjan’salgorithm [15]. Thus, by using these bridges, we can find edges satisfying thecondition in Lemma 3 in O ( m P ). In addition, P G can be computed in constanttime by just removing f from P ′ G . Hence, the following lemma holds. Lemma 5.
Each recursive call at line 6 of Algorithm 1 makes all the childrecursive calls in O ( m P ) time. From Lemma 5, we need some trick to achieve constant amortized timeenumeration since recursive calls near to the root recursive call needs O ( m )4 v u Figure 1: Example of Contraction Rule 1. Vertex v is removed from a graph. u v w u w Figure 2: Example of Contraction Rule 2. Vertex v is removed. Note that thedegree of other vertices are not changed.time. In this paper, we employ the push out amortization technique as the trickintroduced by Uno [18].We first introduce some terminology. Let P be a partial Eulerian trail. Thephrase “the algorithm generates P ” indicates that the algorithm computes P and P G at line 7 and line 8 of Algorithm 1, respectively. We denote by T ( P )of P the exact number of computational steps for generating P . That is, T ( P )does not include the time complexity of descendants of P . Let T ( P ) be the sumof the computation time of generating children of P .Roughly speaking, the push out amortization technique gives a sufficientcondition for proving that an enumeration algorithm runs in O ( T ∗ ) per solutionon average, where T ∗ is the maximum time complexity among leaves. Thissufficient condition is called the push out condition defined as follows. Definition 6.
Let P be a partial Eulerian trail. We call the following equationthe push out condition for our problem: For some two constants α > and β ≥ , T ( P ) ≥ αT ( P ) − β ( |C ( P ) | + 1) T ∗ . Note that we slightly modify the original condition given in [18] to fit ourpurpose. The intuition behind this condition is that if the computation timeof each node is smaller than the sum of that of descendants, then the wholecomputation time is dominated by the computation time of descendants, thatis, the computation time of leaves. In our case, T ∗ = O (1) because m P on aleaf is constant. If each partial Eulerian trail has at least two children, then thecondition clearly holds. However, if there is a partial Eulerian trail P has at mostone child, then the condition may not hold because for the child P ′ of P , P G islarger than P ′ G and thus T ( P ) can be smaller than T ( P ). Hence, we modify P G by contracting vertices and edges so that each non-leaf partial Eulerian trail P has at least two children. This contraction of a graph is performed by applyingthe follow rules. Let v be a vertex in P G . Contraction Rule 1 If v is a pendant, then remove v . Contraction Rule 2 If v is incident to exactly two distinct edges ( u, v ) , ( v, w )and t ( P ) = v , then remove v and add edge ( u, w ) to P G .See Figures 1 and 2. Note that when Contraction Rule 1 is applied to t , thelast vertex of Eulerian trails becomes the unique neighbor of t in P G . We alsonote that when applying Contraction Rule 2, u = w may hold, that is, a loop5n u may be generated. After recursively applying these operations, we say G is contracted if neither Contraction Rule 1 nor Contraction Rule 2 can not beapplicable to G . Clearly, there is a surjection from partial Eulerian trails in G toones in the contracted graph of G . The next lemma shows the time complexityfor obtaining contracted graphs. Lemma 7.
Let G be a graph, P be a partial Eulerian trail in G such that thereis the parent P ′ satisfying P = P ′ + ( u, v ) . Assume that the contracted graphof P ′ G is already obtained. Then, the contraction of P G can be done in constanttime.Proof. The degree of vertices other than u and v is same in P ′ G and P G . Notethat each vertex in a contracted graph has degree at least three. Thus, Con-traction Rule 1 is not applicable. Moreover, Contraction Rule 2 can be appliedto u or v in P G . Hence, by checking the degree of u and v , the contraction canbe done in constant time. Lemma 8.
Each vertex in a contracted graph is incident to at least two non-bridge edges.Proof.
Let G be a contracted graph such that G has an Eulerian trail. Becauseof Contraction Rule 1 and Contraction Rule 2, all vertices are incident to atleast three edges. Suppose that a vertex v incident to two distinct bridges b and b . Otherwise, the lemma holds. Let B i be a connected component of G − v such that b i ∈ B i for i = 1 ,
2. Then, there are two classes of Eulerian trails theone contains paths first visit B and next visit B , and the other first visits B and next B . Because G is Eulerian, v must be incident to at least two edgesfor visiting all the edges in G \ ( B ∪ B ). Hence, the statement holds.Because detecting bridges can be done in O ( m P ) time [15], the time com-plexity of each iteration is O ( m P ). In addition, the difference between thenumber of edges in P G and that in Q G of a child Q of P is constant, and eachproper partial Eulerian trail has at least two children by Lemma 8. Hence,the proposed algorithm satisfies the push out condition and runs in constantamortized time per solution without outputting .Next, we consider the output format of our algorithm. If we simply output allthe solutions na¨ıvely, then total time complexity is O ( mN ). Hence, to achieveconstant amortized time enumeration, we modify our algorithm so that it onlyoutputs the difference between two consecutive solutions. Outputting only thedifference is a well known technique for reducing the total time complexity inenumeration field [14, 16]During the execution of the algorithm, the algorithm maintains two workingmemories W and I . These are implemented by doubly-linked lists. W containsthe current partial Eulerian trail and I contains the information of contractions.When the algorithm finds an edge e such that P + e is a child of P , thenthe algorithm appends e to W . In addition, the algorithm also appends aninformation ξ to I , where ξ represents how the algorithm contracts a graph. ξ forms a set of tuples each of which contains what is added and removed from G , and which rule is used. Then, the algorithm prints +( e, ξ ). We can easilysee that the length of each output is constant. When the algorithm backtracksfrom P ′ , then the algorithm removes e from W and ξ from I , and prints − ( e, ξ ).When the algorithm reaches a leaf, the algorithm prints W . By using the information stored in the working memory,we can get the corresponding Eulerian trail if necessary. Moreover, it is enoughto allocate O ( m ) space to each working memory.Lemmas 3 and 8 imply that each partial Eulerian trail has either zero or atleast two children. This yields the following corollary. Corollary 9.
The number of partial Eulerian trails generated by the algorithmis O ( N ) . Remind that partial Eulerian trails corresponds to nodes on T . Thus, byCorollary 9, the total length of outputs is O ( N ) and the next theorem holds. Theorem 10.
One can enumerate all the Eulerian trails in a graph in constantamortized time per solution with linear space and preprocess time in the size ofthe graph.
In this section, we focus on an enumeration of vertex-distinct Eulerian trails.In a way similar to the previous section, we develop an enumeration algorithmbased on the reverse search technique. We first some terminologies. A pair( u, v ) of vertices is good if there are two parallel edges e and e between u and v such that the corresponding trail of e in the original graph differs from thatof e . Otherwise, we say ( u, v ) is bad . Note that we can check whether ( u, v ) isgood or bad in constant time.The main difference from the edge-distinct problem is that adding paralleledges between a bad pair to a current partial Eulerian trail may generate du-plicate solutions. Note that two parallel edges between a good pair may yieldtwo children if these parallel edges is generated by Contraction Rule 2. This isbecause an added edge by Contraction Rule 2 carries two or more edges. Toensure that each proper partial Eulerian trail has at least two children, that is,each vertex v has at least two distinct edges, we slightly modify an input graphof each recursive call as follows. Contraction Rule 3 If v has exactly two neighbors u and w such that µ v ( u ) =1, ( v, w ) is bad, u and w are distinct from v , and v has no loops, thenremove µ v ( w ) − v and w . Then, add a vertex v ′ and µ v ( w ) − v ′ and w . Contraction Rule 4
Remove incident edges of a vertex v if v has no loops, v has exactly one neighbor u such that ( u, v ) is bad and µ v ( u ) ≥
3. Then,add ⌊ µ v ( u )2 ⌋ loops to u . In addition, add an edge ( u, v ) if µ v ( u ) is odd.See Figures 3 and 4. Note that after performing Contraction Rule 3, thenumber of edges in the resultant graph G ′ and the original graph G are same,and Contraction Rule 2 is applicable to v in G ′ . In addition, after performingContraction Rule 4, Contraction Rule 1 may be applicable. When ContractionRule 3 is applicable to G , there are (a) at least one solution containing ( u, v, w )or ( w, v, u ) and (b) at least one solutions containing ( w, v, w ). This implies thatif t ( P ) = v and Contraction Rule 3 is applicable, then we can generate twopartial Eulerian trails which are extended by (a) and (b). In addition, we can7 v w u v wv ′ Figure 3: Example of Contraction Rule 3. After applying Contraction Rule 3,Contraction Rule 2 and Contraction Rule 4 can be applied to the resultantgraph. u v u v
Figure 4: Example of Contraction Rule 4. After applying this rule, ContractionRule 1 may be applicable. Note that the degree of u is not changed.easily obtain a one-to-one corresponding between solutions in G and G ′ , which G ′ is obtained by applying Contraction Rule 3 or Contraction Rule 4.However, applying Contraction Rule 3 and Contraction Rule 4 may make G drastically small. Let ( v , . . . , v ℓ , v ℓ +1 = v ) be a vertex sequence such thatfor each i = 2 , . . . , ℓ , N ( v i ) = { v i − , v i +1 } and µ v i ( v i − ) = µ v i ( v i +1 ) = 2. Foreach v i , if t ( P ) = v i , then P has two children. However, after adding an edgeincident to v i to P , v j has at most one child for j = 2 , . . . , ℓ −
1. If an inputgraph forms this sequence, then after contracting by Contraction Rule 3 andContraction Rule 1, the size of the resultant graph becomes constant. Thisshrinking prevents the algorithm from satisfying the push out condition. Toavoid such a situation, we introduce another rule.
Multibirth Rule
Let v be a vertex adjacent exactly two distinct neighbors u, w such that (1) t ( P ) = v , (2) v has no loops, (3) µ v ( u ) = µ v ( w ) = 2,and (4) both ( u, v ) and ( v, w ) are bad. Then make a copy G of an inputgraph G , and remove v from G and add two edges between u and w . Inaddition, if v is not a cut in G , then make an additional copy G of aninput graph G , and remove v from G and add self loops ( u, u ) and ( w, w ).This rule comes from the following observation: each solution in G containseither (1) two ( u, v, w ) or (2) ( u, v, u ) and ( w, v, w ). Note that if v is a cut, thenall the solutions contain the former subtrails. Moreover, the set of solutions in G and G are disjoint. Hence, if there is such a vertex v , then the algorithmreplace a child Q of P with two children Q and Q whose associated graphsare G and G , respectively.In this section, we say that a graph G is contracted if Contraction Rule 1to Contraction Rule 4 can not be applicable to G \ P . If a graph is contracted,then we show the key lemmas in this section. Lemma 11.
Let G be a contracted graph and P be a partial Eulerian trail in G .Suppose that P ′ G of the parent P ′ of P is already obtained. Then, contracting P G can be done in constant time. v w (a) u w (b) u w (c) Figure 5: Example of Multibirth Rule. This modification yields one or twographs such thse are obtained by replacing (a) with (b), and (a) with (c).
Proof.
Let e = ( u, v ) be an edge such that P = P ′ + e . Firstly, removing e from P ′ G can be done in constant time. We consider that which rule can be appliedto P G . Because P ′ G is contracted, we have a case analysis with respect to themultiplicity µ v of edges on P ′ G and the number of neighbors of v as follows; Case A: v has at least three distinct neighbors u, w , w If µ v ( u ) > v . We assume that v has exactly three distinct neighbors u, w , w such that µ v ( u ) = 1. A.1: µ v ( w ) ≥ or µ v ( w ) ≥ w and w after adding e to P ′ . A.2: µ v ( w ) = 1 and µ v ( w ) ≥ v . Then,possibly, we also apply Contraction Rule 1, Contraction Rule 2, andContraction Rule 4 to the copy of v . If w is incident to w suchthat µ w ( w ) = 1, then Contraction Rule 2 can be applied to w .However, no more rule can be applied to neither w nor x . Case B: v has exactly two distinct neighbors u, w B.1: µ v ( u ) ≥ µ v ( u ) = 3 and µ v ( w ) = 2, then this case is the same as case A.1.Otherwise, we can not apply any rules to v and w after adding e to P ′ . B.2: µ v ( u ) = 2This case is the same as case A.2 after adding e to P ′ . B.3: µ v ( u ) = 1In this case, Contraction Rule 3 can be applied to v on P ′ G . Because P ′ G is contracted, this derives a contradiction. Thus, this case doesnot happen.We also have the same cases for u . Thus, from the above observation, thenumber of applying contracting rules is constant. Moreover, each rule can beproceeded in constant time. Therefore, the lemma holds.Let P ′ = P + e be the parent of P . Assume that P G is obtained by removing e and repeatedly applying Contraction Rule 1 to Contraction Rule 4 to P ′ G P ′ G has no vertex to which Multibirth Rule can be applied.This yields the number of vertices to which Multibirth Rule is applicable in P G is constant. Moreover, when making children of P , we avoid to generate allthe whole copies of P G by applying Multibirth Rule to reduce the amount ofspace usage. In stead of whole copying, we locally modify v that is a target ofMultibirth Rule. Hence, the following clearly holds. Lemma 12.
Let G be a graph and P be a partial Eulerian trail in G . Sup-pose that P G is contracted. Then, children of P that are generated by applyingMultibirth Rule to P G can be obtained in constant time. From the above discussion, we can obtain the following key lemma.
Lemma 13.
A proper partial Eulerian trail P of a contracted graph G has atleast two children.Proof. Because G is contracted, each vertex has at least two distinct neighbors.If t ( P ) is incident to two bridges, then this contradicts with the definition of apartial Eulerian trail. Thus, t ( P ) is incident to at most one bridge. In addition,if t ( P ) is not incident to a bridge, then the lemma clearly holds.Suppose that t ( P ) is incident to a bridge e = ( t ( P ) , u ). If t ( P ) is adjacentto exactly two vertices, then this implies that we can apply Contraction Rule 3.Hence, t ( P ) is adjacent to more than two distinct vertices and the statementholds.By Lemmas 11 to 13, each non-leaf node P on the family tree made by thealgorithm has at least two children and can be done in O ( m P ) time, where m P isthe number of edges in the contracted graph P G . Remind that the computationtime is dominated by detecting bridges on P G . Thus, by the same discussion inthe previous section, the main theorem in this section is established. Theorem 14.
All vertex-distinct Eulerian trails can be enumerated in constantamortized time per solution with linear time preprocessing and linear space.
Acknowledgement
This work was partially supported by JST CREST Grant Number JPMJCR18K3and JSPS KAKENHI Grant Numbers 19K20350, JP19J10761, and JP20H05793,Japan.
References [1] T. Aardenne-Ehrenfest, van and N.G. Bruijn, de. Circuits and trees inoriented linear graphs.
Simon Stevin : Wis- en Natuurkundig Tijdschrift ,28:203–217, 1951.[2] David Avis and Komei Fukuda. Reverse search for enumeration.
DiscreteApplied Mathematics , 65(1):21 – 46, 1996. First International Colloquiumon Graphs and Optimization. 103] Etienne Birmel´e, Rui Ferreira, Roberto Grossi, Andrea Marino, NadiaPisanti, Romeo Rizzi, and Gustavo Sacomoto. Optimal listing of cyclesand st-paths in undirected graphs. In
SODA 2012: the 24th Annual ACM-SIAM Symposium on Discrete Algorithms , pages 1884–1896, 2012.[4] Graham R. Brightwell and Peter Winkler. Counting eulerian circuits is
Proceedings of the Seventh Workshop on Algorithm Engineeringand Experiments and the Second Workshop on Analytic Algorithmics andCombinatorics, ALENEX /ANALCO 2005, Vancouver, BC, Canada, 22January 2005 , pages 259–262. SIAM, 2005.[5] Zhi-Zhong Chen, Xin He, and Chun-Hsi Huang. Finding double euler trailsof planar graphs in linear time.
SIAM Journal on Computing , 31(4):1255–1285, 2002.[6] Alessio Conte, Roberto Grossi, Grigorios Loukides, Nadia Pisanti, Solon P.Pissis, and Giulia Punzi. Fast Assessment of Eulerian Trails. In
FourthInternational Workshop on Enumeration Problems and Applications , 2020.[7] Rui Ferreira, Roberto Grossi, Romeo Rizzi, Gustavo Sacomoto, and SagotMarie-France. Amortized ˜ O ( | v | ) -delay algorithm for listing chordless cyclesin undirected graphs. In ESA 2014: the 22th Annual European Symposiumon Algorithms , volume 8737 of
Lecture Notes in Computer Science , pages418–429, 2014.[8] Carl Hierholzer and Chr Wiener. Ueber die M¨oglichkeit, einen Linienzugohne Wiederholung und ohne Unterbrechung zu umfahren.
MathematischeAnnalen , 6(1):30–32, 1873.[9] Jarkko Kari. Synchronizing finite automata on eulerian digraphs.
Theoret-ical Computer Science , 295(1):223 – 232, 2003.[10] Yosuke Kikuchi. Enumerating All Eulerian Trails (in Japanese). TechnicalReport Vol.2010-AL-131 No.7, IPSJ, 2010.[11] Carl Kingsford, Michael C Schatz, and Mihai Pop. Assembly complexityof prokaryotic genomes using short reads.
BMC Bioinformatics , 11(1),January 2010.[12] Kuntal Roy. Optimum gate ordering of CMOS logic gates using euler pathapproach: Some insights and explanations.
Journal of Computing andInformation Technology , 15(1):85, 2007.[13] Nicole Schweikardt, Luc Segoufin, and Alexandre Vigny. Enumeration forfo queries over nowhere dense graphs. In
Proceedings of the 37th ACMSIGMOD-SIGACT-SIGAI Symposium on Principles of Database Systems ,SIGMOD/PODS ’18, page 151–163, New York, NY, USA, 2018. Associa-tion for Computing Machinery.[14] Akiyoshi Shioura, Akihisa Tamura, and Takeaki Uno. An optimal algorithmfor scanning all spanning trees of undirected graphs.
SIAM Journal onComputing , 26(3):678–692, 1997. 1115] R.Endre Tarjan. A note on finding the bridges of a graph.
InformationProcessing Letters , 2(6):160 – 161, 1974.[16] Etsuji Tomita, Akira Tanaka, and Haruhisa Takahashi. The worst-casetime complexity for generating all maximal cliques and computational ex-periments.
Theoretical Computer Science , 363(1):28 – 42, 2006. Computingand Combinatorics.[17] Shuji Tsukiyama, Mikio Ide, Hiromu Ariyoshi, and Isao Shirakawa. A newalgorithm for generating all the maximal independent sets.
SIAM Journalon Computing , 6(3):505–517, 1977.[18] Takeaki Uno. Constant time enumeration by amortization. In