Space-filling curves of self-similar sets (II): edge-to-trail substitution rule

It is well known that the constructions of space-filling curves depend on certain substitution rules. For a given self-similar set, finding such rules is somehow mysterious, and it is the main concern of the present paper. Our first idea is to introduce the notion of skeleton for a self-similar set. Then, from a skeleton, we construct several graphs, define edge-to-trail substitution rules, and explore conditions ensuring the rules lead to space-filling curves. Thirdly, we summarize the classical constructions of the space-filling curves into two classes: the traveling-trail class and the positive Euler-tour class. Finally, we propose a general Euler-tour method; using this method we show that if a self-similar set satisfies the open set condition and possesses a skeleton, then space-filling curves can be constructed. Especially, all connected self-similar sets of finite type fall into this class. Our study provides an algorithm to construct space-filling curves of self-similar sets.

(Some figures may appear in colour only in the online journal)

Introduction
Space-filling curves (SFC) have fascinated mathematicians for more than a century since Peano's monumental work in 1890. In a series of three papers ( [37], the present paper, and [38]), we develop a theory to construct SFCs of self-similar sets. For a given connected selfsimilar set, finding substitution rules leading to SFCs is a long-standing and difficult problem, and it is the main concern of the present paper.

A brief history of space-filling curves
SFCs of the first generation were constructed by Peano (1890), Hilbert (1891), Sierpiński (1912) and Pólya (1913) ([19, 32, 33, 41]), where the supporting sets of the SFCs are squares or triangles. Later on, people found many beautiful reptiles as well as their SFCs, where the boundaries of the reptiles are fractals; for instance, Heighway dragon curve ( [11]), Gosper curve ( [17]) (figure 1), etc. (A reptile is a compact set with non-empty interior such that it is a non-overlapping union of similarity copies of itself with the same size.) A survey of the early results can be found in Sagan [40]. In recent years, various interesting SFCs appear on the internet, see for example, Ventrella [48] and Teachout [45]. Figure 2 illustrates two of them. Some applications of SFC can be found in [9,23,29] (in analysis) and [6] (in computer science).
From the 1960's to the 1980's, two systematic methods were introduced to handle the SFCs. The first one is the L-system method, introduced by Lindenmayer [26], a biologist, is known to a very wide audience, see Bader [6]. The second method is the recurrent set method introduced by Dekking [12], which is an improvement of the L-system method. See [37] for the comparing of the two methods.
All the known constructions of SFC depend on certain 'substitution rules'. Indeed, the L-system method and the recurrent set method provide exact meaning of 'substitution rule' and build a bridge from substitution rules to SFCs, but they do not tell us how to construct substitution rules.
There are few works on the construction of substitution rules. Hata [18] shows that if a selfsimilar set is generated by a linear IFS (see section 4 for the definition), then a substitution rule can be obtained. Another way is to consider the attractor of the so-called path-on-lattice IFS (this name is given by [37]). A path on a planar lattice defines a substitution rule as well as a self-similar set; if the self-similar set happens to satisfy the open set condition, then the substitution rule leads to a SFC. This method is widely used to find reptiles and SFCs by computer searching, see Fukuda et al [16], Arndt [3] and Ventrella [48]. But in this method, the self-similar sets are not given a priori. Other attempts of constructing substitution rules for special self-similar sets can be found in Remes [39] and Sirvent [42][43][44]. Definition 1.1. Let K be a compact subset of R d with 0 < H s (K) < ∞. An onto mapping ψ : [0, 1] → K is called an optimal parametrization of K if (i) ψ is almost one-to-one, that is, there exist K ⊂ K and I ⊂ [0, 1] with full measures such that ψ : I → K is a bijection; (ii) ψ is measure-preserving in the sense that Recall that a non-empty compact set K ⊂ R d is called a self-similar set, if there exist contractive similitudes S 1 , . . . , S N : The family {S 1 , . . . , S N } is called an iterated function system, or IFS in short; K is called the invariant set of the IFS. (See for instance, [2,15,20]   S i (U) are disjoint ( [20]). If a self-similar set K satisfies the OSC and has non-empty interior, then we call K a self-similar tile; if in addition, the contraction ratios of S i are all equal, then K is called a reptile ( [21]).
In this paper, we introduce a notion of skeleton of a self-similar set, which is crucial in our theory. As soon as we have a skeleton, we construct SFCs along the following line: Skeleton → graphs and edge-to-trail substitution → space-filling curve → visualization.
To 'see' a SFC, we need to visualize or to approximate the curve, and this has been studied in [37]. In the following, we give a brief description of the first three steps.

Skeleton of a self-similar set
Let {S j } N j=1 be an IFS with invariant set K. Let A be a finite subset of K. We call A a skeleton if it satisfies the following two conditions: (i) It is stable under iteration, that is, A ⊂ N j=1 S j (A); (ii) It is a representative with respect to the connectedness, that is, the so-called Hata graph associated with A is connected. (See section 2 for the precise definition.) From now on, we always assume that K is a connected self-similar set possessing a skeleton which we denote by (1.1)

Graphs and edge-to-trail substitution
First, we recall some terminologies of graph theory, see for instance, [7]. Let H be a directed graph. We shall use e 1 + · · · + e k to denote a walk consisting of the edges e 1 , . . . , e k . We call the starting vertex and terminating vertex of a walk the origin and terminus, respectively. The walk is closed if the origin of e 1 which is the directed complete graph with vertex set A.
We select a spanning subgraph Λ = (A, E) of G 0 as the initial graph of our construction, where A is the vertex set and E is the edge set. Let G be the union of affine images of Λ under S j , i.e.
We call G the refined graph induced by Λ. (See section 3.) If for each edge u ∈ E, we can find a trail P u in G which shares the origin and terminus with u, then we call the mapping u → P u , u ∈ E an edge-to-trail substitution.

Edge-to-trail substitutions to SFCs
Now we investigate when a substitution τ leads to a SFC, or equivalently, an optimal parametrization. Rao and Zhang [37] introduce linear graph-directed iterated function system (linear GIFS), which provides a criterion for optimal parameterizations (section 6 gives the exact definitions of GIFS, linear GIFS and a detailed descriptions of the related results). The SFC of E j in the above theorem is obtained in the following way: for any n 1, the cylinders of rank n of E j have a linear ordered. Imagine a beetle is moving on E j . It runs over all the points in a cylinder of rank n before it moves to the next one, and the time the beetle staying in a cylinder is proportional to the Hausdorff measure of the cylinder.
However, for a self-similar set K, usually the generating IFS is not linear. The main purpose of this paper is to build a new GIFS for K such that the new GIFS is linear and satisfies the OSC. To this end, we introduce the edge-to-trail substitution which induces a linear GIFS in a natural way (theorem 7.1). Now our task is to construct 'nice' edge-to-trial substitutions which do lead to SFCs. First, using our point of view, we summarize the constructions of SFC in the literature into two classes, the traveling-trail method and the positive Euler-tour method, and provide rigorous treatments. Then we introduce an universal method, the general Euler-tour method, which can construct SFCs for all connected self-similar sets with skeleton.
(1) Traveling-trail method. A trail of length N in the refined graph G = N j=1 S j (Λ) is called a traveling trail, if for every j ∈ {1, . . . , N}, the trail contains exactly one edge in S j (Λ). We show that Theorem 1.2. If all the trails P u in an edge-to-trail substitution τ are traveling trails, then τ leads to a space-filling curve of K.
A special class of IFS, called self-similar zipper (see definition 4.1), is first introduced by Thurston [47] and plays a role in complex analysis ( [5,47]). Recently, there are some works on self-similar zippers on the fractal aspect [4,34,46]. Indeed, the self-similar zipper is a special case of linear GIFS with two states (theorem 6.2). As a consequence of theorems 1.1 and 6.2, we have Corollary 1.1. If a self-similar zipper satisfies the OSC, then its invariant set admits optimal parameterizations.
(2) Positive Euler-tour method. A natural selection of the initial graph is Λ = − − → a 1 a 2 + · · · + −−−−→ a m−1 a m + −−→ a m a 1 , the cycle passing all the elements of A. Next, we choose an Euler tour of the refined graph G and a partition of this Euler tour. This partition can give us an edge-to-trail substitution if a consistency condition is fulfilled, and leads to a SFC of K if it further satisfies the primitivity condition and pure-cell condition (theorem 8.2).
Does every self-similar set admit SFCs? To answer this question, we introduce a general Euler-tour method.
(3) (General) Euler-tour method. Let Λ −1 be the reverse cycle of the initial cycle Λ in the positive Euler-tour method. Now, in the refined graph G, we allow negative orientation, that is, for some j , we replace S j (Λ) by S j (Λ −1 ). Then we have much more choices of refined graphs and Euler tours, which increase the possibility of finding an edge-to-trail substitution that can produce SFCs. Our main result is The difficult part of theorem 1.3 is to prove the non self-similar zipper case, which we divide into two steps. First, we prove theorem 8.2, which transfers the SFC problem to a graph theory problem. Then, we solve the graph theory problem in sections 9 and 10, where we use bubbling process and orientation adjustment to produce the desired Euler tours.
Self-similar sets of finite type is an important class of fractals, see for instance [8,27,36]. In a subsequent paper [38], we show that if K is a self-similar set of finite type, then K possesses skeletons.  [16] and the websites [45,48]. (See section 4.) Remark 1.3. The following curves are constructed by positive Euler-tour method: Sierpiński curve, Terdragon curve in Dekking [12] and the four-tile star in [45] (see figure 2(b)). We present two new examples: Sierpiński carpet (example 5.2) and the Rocket tile (example 5.3).

Example 1.1 (The Christmas tree).
The Christmas tree is a fractal with 5 branches. Figure 13 provides a SFC of it, where the negative orientation is involved; the details are given in section 8.4. It can be parameterized with the positive Euler-tour method, but then the parametrization is not measure-preserving since the edge-to-trail substitution cannot be primitive.

Example 1.2 (Integral self-affine tiles).
Let A be an integral n × n expanding matrix, and D ⊂ Z n be a set with #D = | det A|, where #D denotes the cardinality of D. Let T be the unique compact set satisfying The set T is called an integeral self-affine tile if it has positive Lebesgue measure. (See Lagarias and Wang [24] and the reference therein). By theorem 1.4, every integral self-affine tile admits SFCs. The Rocket tile is taken from Duvall et al [14]. It is an integral self-similar tile with 9 branches. A SFC is shown in figure 7. The details are given in example 5.3.
The paper is organized as follows. In section 2, we give a brief description of skeletons of self-similar sets. In section 3, we describe the general philosophy of constructing edge-to-trail substitutions by graphs. Sections 4 and 5 are devoted to the traveling-trail method and the positive Euler-tour method, respectively. In sections 6 and 7, we show an induced GIFS is always a linear GIFS, and theorem 1.2 is proved there. Sections 8-11 are devoted to the Eulertour method, and theorem 1.3 is proved in section 11.

Skeleton of self-similar set
In this section, we give a brief introduction to skeletons of self-similar sets. A detailed study is carried out in Rao and Zhang [38].   [22] and Morán [30] studied the 'boundary' (also called 'vertices' if it is finite) of a fractal. A skeleton is usually chosen to be a subset of the 'boundary' of a selfsimilar set; for a so-called p.c.f. self-similar set, the set of vertices is a skeleton. Indeed, the choices of skeletons are much more arbitrary.

Iteration
We denote Σ = {1, . . . , N} and call it an alphabet. Let I = i 1 i 2 . . . i n ∈ Σ n , we call it a word of length n. We denote the length of a word I by |I|. We define the nth iteration of S to be the IFS It is well-known that the invariant set K of the IFS S is also the invariant set of S n (see Falconer [15]). Similarly, we have

Proposition 2.3 ([38]). If A is a skeleton of S, then A is also a skeleton of S n .
Using neighbour graph of self-similar sets, it is shown that a connected self-similar set of finite type always possesses skeletons ( [38]), and actually an algorithm of finding skeletons is given there. There do exist self-similar sets without skeletons (see figure 8).

Graphs and edge-to-trail substitutions: the general philosophy
be an IFS possessing a skeleton and satisfying the OSC. Denote its invariant set by K, and let A = {a 1 , a 2 , . . . , a m } be a skeleton. Recall that Figure 8. A reptile without skeleton, see [38].
is a directed complete graph with vertex set A. We note that the edges −→ a i a j are abstract edges rather than oriented line segments; moreover, i may be equal to j , see example 4.1.
Next, we choose a spanning subgraph Λ = (A, E) of G 0 such that Λ contains no isolated vertex. We call Λ the initial graph. To continue our construction, we need to define the affine copy of a directed graph. Definition 3.1. Let G = (A, Γ) be a directed graph such that the vertex set A ⊂ R d . Let S : R d → R d be an affine mapping. We define a directed graph S(G) = (S(A), S(Γ)) as follows: there is an edge in S(Γ) from S(x) to S(y) if and only if there is an edge e ∈ Γ from vertex x to y . Moreover, we denote this edge by S(e) (Rigorously, we should understand S(e) as a pair (e, S)).

Remark 3.1.
(i) If (A 1 , Γ 1 ) and (A 2 , Γ 2 ) are two graphs without common edges, then we define their union to be the graph (A 1 ∪ A 2 , Γ 1 ∪ Γ 2 ). (ii) Even if S j (e k ) coincides with S j (e k ) as oriented line segment, they should be regarded as different edges, since (e k , S j ) = (e k , S j ).

Refined graph and edge-to-trail substitution
Let G be the union of affine images of Λ under S j , that is, and we call it the refined graph induced by Λ. Let τ be a mapping from E to trails of G; we shall denote τ (u) by P u to emphasize that τ (u) is a trail. We call τ an edge-to-trail substitution, if for all u ∈ E, P u has the same origin and terminus as u.
An edge-to-trail substitution τ can be thought as replacing each big edge u by a trail P u consisting of small edges. Our goal is to construct edge-to-trail substitutions which lead to SFCs.

Iteration of edge-to-trail substitutions
We define τ n (u) recurrently as follows. Let n 2 and let L = T 1 (γ 1 ) + · · · + T k (γ k ), T j ∈ S n−1 and γ j ∈ E be a trial in the refined graph |J|=n−1 S J (Λ). We define τ (L) to be the trial in the graph |I|=n S I (Λ). Hence, we define τ 1 (u) = τ (u) and τ n (u) is defined by using (3.2) repeatedly. Geometrically, the action of τ is to replace an edge by a trail consisting of smaller edges, and finally τ n (u) can be regarded as an oriented broken line, which provides an approximation of the corresponding SFC.

Traveling-trail method
Recall that a trail P in G = N j=1 S j (Λ) is called a traveling trail, if for every j , P contains exactly one edge in S j (Λ). Theorem 1.2 asserts that if all the trails P u in an edge-to-trail substitution τ are traveling trails, then τ leads to a SFC of K. We postpone the proof of theorem 1.2 to section 7. In this section, we summarize the SFCs constructed by this method.

Linear IFS
Let K be a self-similar set. Assume that K has a skeleton consisting of two points, say is a trail from a to b, where we use the symbol '+' to connect the consecutive edges or sub-trails, then is an edge-to-trail substitution such that τ (u) is a traveling trail. Such IFS, called a linear IFS in [37], was first studied by De Rahm [13] and Hata [18], where they proved that a linear IFS leads to a SFC, which is a direct generalization of Peano's original construction.

Self-similar zipper
is an edge-to-trail substitution such that both τ (u) and τ (u −1 ) are traveling trails.
The path-on-lattice IFS in [37] is a special case of the self-similar zipper; Hilbert curve, Heighway dragon curve and Gosper curve are obtained by this way, see section 5 of [37].

Space-filling curves of polygonal reptiles
In the web-site [45], there are many interesting SFCs of polygonal reptiles constructed by traveling-trail method. We take the Wedge tile as an example.

Example 4.1 (The wedge tile). The Wedge tile is a self-similar set generated by the
, where the maps are indicated by figures 9(a) and (b), where we use an arrow to specify whether the linear part of S j contains reflection or not.
We choose A = {a 2 , a 4 }, two vertices of the wedge, to be the skeleton. Choose Then τ : is an edge-to-trail substitution. The trails τ (α) and τ (γ) are illustrated by figures 9(c) and (d); the trail τ (β) is the reverse trail of τ (α). A visualization of the SFC corresponding to τ is shown in figure 2(a).

Hexaflake
Hexaflake is a fractal constructed by iteratively exchanging each hexagon by a flake of seven hexagons, see figure 5(a). We choose A = {a 1 , . . . , a 6 }, the vertex set of the original hexagon, to be our skeleton, and choose the initial graph to −→ a i a j , and hence this similitude induces a trail which we define to be τ ( −→ a i a j ). The rule τ satisfies the condition of theorem 1.2. Figure 5(b) gives a visualization of the corresponding SFC.

Positive Euler-tour method
Another frequently used method of constructing SFC is the positive Euler-tour method. Let to by the cycle passing all the elements of A. We set Λ to be our initial graph, and let G = N i=1 S j (Λ) be the refined graph. Lemma 5.1. The refined graph G admits Euler tours.

vertices of a path connecting S i and S j in the Hata graph H(S, A). Then one can easily prove by induction that the graphs
are all connected. Set = k , we get that G is connected. Finally, G admits Euler tour, since it is an edge-disjoint union of closed trails (see [10]). □ Let P be an Euler tour of the refined graph G. Let P = P 1 + · · · + P m be a partition of P such that for all j , P j is a sub-trail having the same origin and terminus as u j . Then gives us an edge-to-trail substitution. If P and the partition are carefully chosen, then τ will lead to a SFC. The rigorious treatment is given in section 8. which consists of the fixed points of S j , j = 1, 2, 3. Choose the initial graph to be

Example 5.1 (Terdragon). Terdragon is generated by the IFS
According to the of the Euler-partition in figure 4(d), we obtain the following edge-to-trail substitution: τ : Remark 5.2. We shall see in section 8 that SFCs obtained by the Euler-tour method are all closed curves, and the invariant sets of the induced GIFS form a partition of the original self-similar set K.

Example 5.2 (Sierpiński carpet).
We choose the skeleton to be the middle points of the edges of the unit square, see figure 3 (right). An Euler tour of the refine graph is shown in figure 6(b), and a partition of this Euler tour is indicated by colors. The edge-to-trail substitution is indicated by figures 6(a) and (d). Figure 6(f) shows the invariants of GIFS associated with the edge-to-trail substitution, which form a partition of the carpet. (Dekking [12] gives a certain 'parametrization' of the carpet where there are infinitely many jumps.)

A stronger version of positive Euler-tour method
Instead of a cycle, we can choose the initial graph Λ to be a closed trail passing all the elements of A, say, Still we can define refined graphs, Euler tours, edge-to-trial substitutions and SFCs. In the following example, we make such a choice, where the advantage is that the visualizations of the resulted SFC are self-avoiding.

Example 5.3 (The Rocket tile). The Rocket tile is generated by the IFS
(The a j 's are fixed points of S 4 , S 1 , S 6 and S 9 respectively.) We choose the initial graph to be the closed trail see figure 11(b). The refined graph of Λ contains 54 edges. An Euler tour of the refined graph is indicated by figure 11(c), where a partition of this tour is indicated by 6 different colors. The edge-to-trail substitution is indicated in figures 11(b) and (e).

Linear GIFS
In this section, we recall the definition of the linear GIFS introduced in [37].

GIFS
Let G = (A, Γ) be a directed graph with vertex set A and edge set Γ. Let be a family of similitudes. We call the triple (A, Γ, G), or simply G , a graph-directed iterated function system (GIFS). We call (A, Γ) the base graph of the GIFS. In what follows, we shall call A a state set instead of vertex set, to avoid confusion with other graphs. Very often but not always, we set A to be {1, . . . , N}. Let Γ ij be the set of edges from state i to j . It is well known that there exist unique non- the invariant sets of the GIFS [28]. The set equations (6.2) provide an alternative way to define a GIFS. We shall call (6.2) the set equation form of GIFS (6.1).

Symbolic space related to a graph G
A sequence of edges in G = (A, Γ), denoted by ω = ω 1 ω 2 . . . ω n , is called a walk, if the terminus of ω i coincides with the origin of ω i+1. (Here we do not use the notation ω 1 + · · · + ω n for simplicity.) be the set of all walks with length k, the set of all walks with finite length, and the set of all infinite walks, emanating from the state i, respectively. Note that where t(γ) denotes the terminus of the walk γ (and γ n ). Iterating (6.2) k-times, we obtain We define a projection π :

Order GIFS and linear GIFS ([1, 37])
Let (A, Γ, G) be a GIFS. To study the 'advanced' connectivity property of the invariant sets, we equip a partial order on the edge set Γ enlightened by set equation (6.3). Let Γ i = Γ 1 i be the set of edges emanating from the state i. Definition 6.1. We call the quadruple (A, Γ, G, ≺) an ordered GIFS, if ≺ is a partial order on Γ such that (i) ≺ is a linear order when restricted on Γ j for every j ∈ A; (ii) elements in Γ i and Γ j are not comparable if i = j.
The order ≺ can be extend to Γ n i and Γ ∞ i for every i ∈ A. On Γ n i , two elements is a linear order. In the same manner, we can obtain a linear order of Γ ∞ i , which we still denote by ≺. In the following, we say ω is lower

Chain condition
Let (A, Γ, G, ≺) be an ordered GIFS. Fix i ∈ A. Let ω be an edge emanating from state i. Let δ(ω) and ∆(ω) be the lowest and highest walks in Γ ∞ i initialled by the edge ω, respectively. Definition 6.3. An ordered GIFS is said to satisfy the chain condition, if for any i ∈ A, and any two adjacent edges ω, γ ∈ Γ i with ω ≺ γ, it holds that The chain condition provides a simple criterion for linear GIFS.

Theorem 6.1 ([37]
). An ordered GIFS is a linear GIFS if and only if it satisfies the chain condition.

Self-similar zippers and linear GIFS
For the definition of self-similar zippers, see definition 4.1. . . . , β N ) if and only if the following ordered GIFS with two states is a linear GIFS. If the OSC holds in addition, then the invariant set K of (S i ) N i=1 admits optimal parameterizations.
be the projections associated with E 1 and E −1 defined as (6.4).
Let δ and ∆ be the lowest path and highest path emanating from the state E 1 , respectively. The form of δ and ∆ are completely determined by β 1 and β N . We claim that π 1 (δ) = x 0 , π 1 (∆) = x N .
If β 1 = 1, then the lowest edge emanating from E 1 is ω = (E 1 , 1, S 1 , E 1 ), where the components of ω means the initial state, the order, the contraction map, and the terminal state, respectively; hence δ = (E 1 , 1, S 1 , E 1 ) ∞ and the contraction maps associated with δ is (S 1 ) ∞ . On the other hand, the zipper condition implies that S 1 (x 0 ) = x 0 , so we obtain If β N = 1, then the highest edge emanating from E 1 is (E 1 , N, S N , E 1 ), hence ∆ = (E 1 , N, S N , E 1 ) ∞ and the contraction maps associated with ∆ is (S N ) ∞ . On the other hand, the zipper condition implies that S N (x N ) = x N , so we obtain A similar calculation as above shows that both (x 0 , x N ) and (π 1 (δ), π 1 (∆)) equal

X-R Dai et al
Our claim is proved.
Finally, notice that the zipper condition is exactly the chain condition, so (6.5) is a linear GIFS.
The other side is obvious. The theorem is proved. □

Induced GIFS
In this section, we define the induced GIFS of edge-to-trail substitutions, especially we show that they are linear GIFS.
Let τ : u → P u , u ∈ E be an edge-to-trail substitution defined in section 3. The trail P u can be written as where S u,j ∈ S and v u,j ∈ E for j = 1, . . . , u . According to τ we can construct an ordered GIFS as follows. Replacing P u by E u on the left hand side, and replacing u by E u on the right hand side of (7.1), we obtain an ordered GIFS: which we call the induced GIFS of τ . In an ordered GIFS, we use '+' to replace the '∪' in the set equation to emphasis the order structure.

Example 7.1 (Induced GIFS of terdragon).
The edge-to-trail substitution τ in example 5.1 induces the following GIFS: The invariant sets E j are illustrated in figure 10(c).
be the basic-graph form of the ordered GIFS (7.2). The state set is E, which is the edges of the initial graph. The edge set Γ consists of quadruples (u, S j , v, k), that is, if S j (v) is the kth edge in the trail P u , then we add an edge to Γ and denote this edge by The contraction associated with this edge is S j .

Theorem 7.1. The induced GIFS (7.2) is a linear GIFS.
Proof. Let u ∈ E. We denote by a u and b u the origin and the terminus of u as an edge in the initial graph Λ = (A, E). We claim that the lowest and highest elements in Γ ∞ u are codings of a u and b u , respectively.
Let S(v) be the first edge in P u , then ω = (u, S, v, 1) is the lowest edge emanating from u in the basic graph Γ. It follows that is a coding of a u . Applying the same argument to v, we obtain a coding of a u , such that the first two edges of this coding is the lowest walk in Γ 2 u . Continuing this argument, we conclude the lowest element in Γ ∞ u is a coding of a u . Similarly, the highest element in Γ ∞ u is a coding of b u . Now, let ω = (u, S, v, k) and γ = (u, T, v , k + 1) be two consecutive edges in Γ u . This means that S(v) and T(v ) are two adjacent edges in P u , so On the other hand, write ∆(ω) = ω(ω n ) n 1 , then (ω n ) n 1 is the highest coding in Γ u . So π v ((ω n ) n q ) = b v by the claim above, and Similarly, we have π u (δ(γ)) = T(a v ). This verifies the chain condition. Therefore, the ordered GIFS in consideration is linear. Fix an u ∈ E. The traveling property of τ implies that the associated contractions with edges in Γ n u are exactly the maps S I , I ∈ {1, . . . , N} n , and each map appears only once. It follows that where g ω = g ω1 • · · · • g ωn is the contraction associated to the trail ω. Taking the limit in Hausdorff metric at both sides, we obtain E u = K. This proves that the invariant sets of the GIFS are all equal to K.
Moreover, if we ignore the order structure, then the induced GIFS degenerates to the original IFS of K, so the induced GIFS satisfies the OSC. Hence, K admits optimal parameterizations according to theorem 1.1. □

(General) Euler-tour method
In this section, we introduce the general Euler-tour method. Recall that A = {a 1 , . . . , a m } is a skeleton. We denote where we identify a m+1 with a 1 . Then Definition 8.1. Let P be an Euler tour of G(S, A, β), and let P = P 1 + · · · + P m be a partition of P. We call it an Euler-partition of G(S, A, β) if the initial points of P 1 , . . . , P m , denoted by a τ (1) , . . . , a τ (m) , is a permutation of A. We call τ the output permutation of P 1 + · · · + P m .

Consistency and induced edge-to-trail substitution
Definition 8.2. We say an Euler-partition P 1 + · · · + P m of G(S, A, β) is consistent, if P i has the same origin and terminus as u i for each i ∈ {1, 2, . . . , h}.
As soon as P 1 + · · · + P m is consistent, we can define an edge-to-trail substitution over We call τ the induced edge-to-trail substitution of the Euler-partition P 1 + · · · + P m .
, then it is seen that the generalized Euler-tour method is a special case of the construction in section 3.
Denote the length of P j by j , then P j has the form where S j,k ∈ {S 1 , . . . , S N }, and u j,k ∈ E. Accordingly, The substitution (8.2) induces the following linear GIFS (by theorem 7.1): We call GIFS (8.5) the induced GIFS of the Euler-partition P 1 + · · · + P m . We shall use (E, Γ, G, ≺) to denote this GIFS, as we explained in section 7. Now we give some basic properties of the induced GIFS.
(ii) For each u ∈ E and i ∈ {1, . . . , N}, S i (E u ) appears exactly once in the right-hand side of (8.5).

Proof.
(i) Set F u = E u −1 for u ∈ E. Clearly {F u } u∈E also satisfy the set equation (8.5) if we ignore the order structure. Hence (i) follows from the uniqueness of the invariant sets. (ii) Since P is an Euler tour, for each u ∈ E and i ∈ {1, . . . , N}, the edge S i (u) appears exactly once in P ∪ P −1 , which implies (ii). (iii) Taking the union of both sides of (8.5) and using the conclusion of (ii), we have Therefore, by the uniqueness of the invariant set of an IFS, we obtain where the last equality holds since E u = E u −1. □ Lemma 8.2 (ii) means that for each u ∈ E, there are exactly N edges in Γ terminating at u; moreover, the associated maps of these edges run over the maps S 1 , . . . , S N .

Primitivity and the open set condition
To ensure the induced GIFS satisfies the OSC, we need a primitivity condition.
Since E u = E u −1, in the induced GIFS, we can identify E u and E u −1 to simplify the discussion. By identifying u and u −1 in τ , and ignoring the maps S j in τ (u), we define a morphism over {u 1 , . . . , u m } by where |u| = |u −1 | = u for u ∈ E + . We call τ * the induced morphism. Recall that τ * is primitive if there exists an integer n such that for any i, j ∈ {1, 2, . . . , m}, u i appears in (τ * ) n (u j ); see for instance [35].

Definition 8.3.
We say a consistent Euler-partition P 1 + · · · + P m of G (S, A, β) is primitive, if the induced morphism τ * is primitive.  Figure 12(a) illustrates a consistent partition P 1 + P 2 + P 3 , where the trails are indicated by colors. The induced edge-to-trail substitution is: The induced morphism is and it is primitive. Figure 12(c) illustrates τ 2 (Λ). The real number s satisfying Φ(M(s)) = 1 is called the similarity dimension of the GIFS, where Φ(·) denotes the spectral radius of a matrix. Let H s be the s-dimensional Hausdorff measure; a set E is called an s-set, if 0< H s (E) < ∞. A directed graph is said to be strongly connected, if for any pair of vertice i and j , there is a trail from i to j . The following criterion of the OSC is proved in [28] (the 'only if' part) and [25] (the 'if' part). N (or for all 1 j N).

Lemma 8.3. Let F be a GIFS with a strongly connected base graph. Denote its invariant sets by {E j } N j=1 , and the self-similar dimension by δ. Then F satisfies the open set condition if and only if
namely, the sum of entries of each collum of M(s) is 1. By Perron-Frobenius theorem (see lemma 8.4 below), the spectral radius of M(s) equals 1, which implies that s is the similarity dimension of the induced GIFS.
We identify E u and E u −1 in the induced GIFS (8.5) and forget the order, then we obtain a simplified GIFS as follows: We have the following facts concerning the simplified GIFS: (i) The base graph of the simplified GIFS is strongly connected, since the induced morphism τ * is primitive. The following is a part of the Perron-Frobenius theorem, see for example [31].

Lemma 8.4 (Perron-Frobenius theorem). Let B = [a ij ] be a non-negative
(i) There is a non-negative eigenvalue λ such that it is the spectral radius B.
(ii) We have min i k j=1 a ij λ max i k j=1 a ij .

Pure-cell property and the disjointness of K = u∈E + E u
Finally, we investigate when K = u∈E + E u is a disjoint union in Hausdorff measure. For I ∈ Σ n , we call the set of edges a positive and a negative S I -cell, respectively.
Definition 8.4. Let τ be an edge-to-trail substitution induced by an Euler-partition P 1 + · · · + P m . Let I ⊂ Σ n . The cell S I (Λ ±1 ) is called a pure cell, if there exists u ∈ E such that the S I -cell is a subgraph of τ n (u). In this case, we also say the partition P 1 + · · · + P m potentially contains pure cell.

Proof.
(i) Suppose that an S I -cell is a pure cell, i.e. all the edges of the S I -cell belong to τ n (u) for some u ∈ E, where n = |I|. Without loss of generality, we may assume that the orientation of the S I -cell is positive. Then all S I (E v ), v ∈ E + appear in the right hand side of the nth iteration of the set equation (8.5) corresponding to E u . Hence, v∈E + S I (E v ) is a disjoint union in the s-dimensional Hausdorff measure, since the induced GIFS satisfies the OSC (by theorem 8.1); it follows that its image under S −1 I , v∈E + E v is also a disjoint union in Hausdorff measure. (ii) By theorem 7.1, the induced GIFS is a linear GIFS. By theorem 8.1, the induced GIFS satisfies the OSC, and all the invariant sets are s-sets.
Let L j = H s (E vj ), and L = m j=1 L j . By theorem 1.1, for each j ∈ {1, . . . , m}, there exists an optimal parametrization ϕ j : [0, L j ] → E vj such that ϕ j (0) and ϕ j (L j ) are the origins and terminus of v j , respectively.
Let ϕ : [0, L] → K be the curve obtained by joining all the ϕ i one by one. Since K = v∈E + E v is a disjoint union in measure, we conclude that ϕ is an optimal parametrization of K. □

The Christmas tree
The Christmas tree is the invariant set of the To get a primitive substitution, we choose an orientation vector β = (−1, 1, −1, 1, 1). Using the Euler-partition in figure 13(e), we get the following edge-to-trail substitution (8.12) and the rules for u −1 can be obtained accordingly.

Consistency
In this section and the next section, we will confirm the conditions in theorem 8.2. In this section, we study the existence of consistent Euler-partitions. Let τ be a permutation of {1, . . . , m}. Denote by Λ τ the cycle passing the elements of A τ = {a τ (1) , . . . , a τ (m) } one by one. As before, set For simplicity, we abbreviate G(S, A τ , β) as G(S, A τ ) when β = (1, 1, . . . , 1) is totally positive. The main idea in this section is to generate an Euler tour of G(S, A τ ) by a bubbling process.

Bubbling property
First, we give some definitions. We say two subgraphs H 1 and H 2 are edge-disjoint, denoted by H 1 ∩ H 2 = ∅, if they do not have a common edge.
Let P be an Euler tour of a directed graph G, and let C = e 1 + · · · + e h ⊂ G be a cycle. We call C a remaining cycle of P, if e j appears earlier than e j +1 in P for all 1 j < h when we regard e 1 as the starting edge of P. (See figure 14) In this case, P can be uniquely written as P = e 1 + L 1 + · · · + e h + L h , (9.2) where some L j may be empty trails. We call L j out-trails w.r.t. C, and call (9.2) the out-trail decomposition of P w.r.t. C.

Definition 9.1 (Cell-exact subgraph). A subgraph H of G(S, A
Definition 9.2 (Bubbling property). Let H ⊂ G(S, A τ , β) be a cell-exact subgraph, and let P be an Euler tour of H. We say P satisfies the bubbling property, if for all S i (Λ) ⊂ H , the cell S i (Λ) is a remaining cycle of P, and all the outpaths w.r.t. S i (Λ) are cell-exact.
The goal of this section is to prove the following theorem.
Theorem 9.1. There exist an integer n and a permutation τ such that G(S n , A τ ) has an Euler-partition P = P 1 + · · · + P m which is consistent and satisfies the bubbling property. Definition 9.3. Let P be an Euler tour of G (S, A τ , β). We say a cell S i (Λ τ ) = e 1 + · · · + e m is unbroken, if e k + · · · + e m + e 1 + · · · + e k−1 is a subtrail of P for some k ∈ {1, 2, . . . , m}.

Figure 14.
A remaining cycle C = e 1 + e 2 + e 3 + e 4 and its out-trials.

Recall that H(S, A) is the Hata graph induced by
3) such that for any 1 j N − 1, the subgraph consisting of the edges r 1 , . . . , r j is connected. This means that starting from a certain cell, we can add the cells one by one in the order (9.3) to obtain G(S, A τ ), and all the subgraphs in the process are connected. By changing the names of S j , we may assume without loss of generality that the cells are added in the order S 1 (Λ τ ), . . . , S N (Λ τ ). Then one vertex of r j is S j +1 , and the other vertex of r j belongs to {S 1 , S 2 , . . . , S j }, which we denote by S ϕ( j) . We note that if S k is a top of R, then ϕ( j) can not take the value k for any j . See figure 15. Now, we construct inductively a sequence (∆ k ) N k=1 such that ∆ k is an Euler tour of k j=1 S j (Λ τ ) satisfying the bubbling property (see definition 9.2). Let ∆ 1 = S 1 (Λ τ ) be the first Euler tour, which clearly satisfies the bubbling property. Suppose ∆ k has been constructed, 1 k N − 1. Now we add the cell S k+1 (Λ τ ) to ∆ k . In the tree R, S k+1 is connected to S ϕ(k) ∈ {S 1 , . . . , S k }, so Take any point z * from the above intersection. Write S ϕ(k) (Λ τ ) = e 1 + · · · + e m and S k+1 (Λ τ ) = e 1 + · · · + e m , where both e 1 and e 1 have origin z * . The outpath decomposition of ∆ k w.r.t. S ϕ(k) (Λ τ ) can be written as ∆ k = e 1 + L 1 + · · · + e m + L m . Set ∆ k+1 = e 1 + L 1 + · · · + e m + L m + (e 1 + · · · + e m ), then ∆ k+1 is an Euler tour of the graph k+1 j=1 S j (Λ τ ). Now we show that ∆ k+1 satisfies the bubbling property. For a cell S j (Λ τ ) ⊂ ∆ k+1 , no matter it is S k+1 (Λ τ ), or is S ϕ(k) (Λ τ ), or belongs to a certain L i (1 i k), one can easily prove that it is a remaining cycle of ∆ k+1 and all its out-trials are cell-exact. The bubbling property is proved.
Set k = N, we obtain the following: Lemma 9.1. For any permutation τ of A, there exists an Euler tour ∆ τ of G(S, A τ ) satisfying the bubbling property. Moreover, if S i is a top of the spanning tree R, then S i (Λ τ ) is an unbroken cell of ∆ τ .

An Euler-parition of ∆ τ
Now we introduce a natural partition of ∆ τ . We start from the vertex a 1 , and walk along ∆ τ . We record the elements of A appearing on the Euler tour but without repetition, then we get a rearrangement of A, which we denote by a τ * (1) , · · · , a τ * (m) .
Let P j be the subtrail of ∆ τ starting from the first visiting of a τ * ( j) and ending at the first visiting of a τ * ( j+1) , then is an Euler-partition of G(S, A τ ) with output permutation τ * .

A cycle of permutations of A
By sections 9.2 and 9.3, starting from a permutation τ of A, we can construct an Eulerpartition P τ of G(S, A τ ). Since there are only finite many permutations of A, there exist a sequence of permutations τ 1 , . . . , τ h+1 with τ h+1 = τ 1 such that τ j+1 is the output permutation of P τj , 1 j h.

Composition of Euler-partitions
Let P = P 1 + · · · + P m be an Euler-partition of G(S, A τ1 ) with output permutation τ 2 , and let Q = Q 1 + · · · + Q m be an Euler-partition of G(S n , A τ2 ) with output permutation τ 3 . Since Q is an Euler tour of the refined graph I∈Σ n S I (Λ τ2 ), each edge in Q can be written as τ2(k+1) ). (9.5) Notice that S I (P k ) is a trail having the same origin and terminus as the edge in (9.5). So, we can define an Euler tour of G(S n+1 , A τ1 ) by replacing every edge S I ( −−−−−−−−→ a τ2(k) a τ2(k+1) ) in Q by the trail S I (P k ). We denote this replacement rule by σ, that is, and set σ(ω) = σ(ω 1 ) + · · · + σ(ω ) for any trail ω = ω 1 + · · · + ω . We define the composition of P and Q to be which is an Euler-partition of G(S n+1 , A τ1 ).
Lemma 9.2. Let P = P 1 + · · · + P m be an Euler-partition of G(S, A τ1 ) with output permutation τ 2 , and let Q = Q 1 + · · · + Q m be an Euler-partition of G(S n , A τ2 ) with output permutation τ 3 . Then (i) If both P and Q have the bubbling property, then Q • P also does.
If the numbers of unbroken cells in P and Q are u and v, respectively, then the number of unbroken cells in Q • P is no less than (u − 1)v.

Proof.
(i) Take I ∈ Σ n and j ∈ Σ. Since Q has the bubbling property, the outpath decomposition w.r.t. S I (Λ τ2 ) can be written as τ2( j+1) ), and the outpaths L j are cell-exact. Then Q • P can be written as where σ is the replacement rule defined in (9.6).
is bubbling w.r.t. S Ij (Λ τ1 ). This is clearly true since P is bubbling w.r.t. S j (Λ τ1 ) by our assumption, and the bubbling property does not change under a linear transformation. This finishes the proof of (i). (ii) Is obvious, since σ(Q k ) has the same origin and terminus as Q k . (iii) Let S I (Λ τ2 ) = e 1 + · · · + e m be an unbroken cell of Q k . Then σ(e 1 + · · · + e m ) = S I (P 1 ) + · · · + S I (P m ) is the affine image of P under S I , and it is a subtrail of Q • P by the unbroken property. This subtrail contains at least u − 1 unbroken cells of Q • P, since under S I , all unbroken cells in P map to unbroken cells of Q • P, except at most one of them may be no longer unbroken after gluing to the trail Q • P \ S I (P). So Q • P contains at least (u − 1)v unbroken cells. □ Proof of theorem 9.1. We have shown that there exists a sequence of permutations τ 1 , . . . , τ h and a sequence of Euler-partitions Q 1 , . . . , Q h such that for k = 1, . . . , h, (i) Q k is an Euler-partition of G(S, A τ k ) with output permutation τ k+1, where we identify τ 1 and τ h+1; (ii) Q k has the bubbling property.
By lemma 9.2, is an Euler-partition of G(S h , A τ1 ) with output permutation τ 1 and satisfying the bubbling property. This P is the desired Euler-partition. □ Remark 9.3. If H(S, A) has a spanning tree with 3 or more tops, then we can require the Euler-partition P in theorem 9.1 containing at least 3 · 2 h−1 unbroken cells.

Primitivity
Let Q = Q 1 + · · · + Q m be an Euler-partition of G(S, A τ ) which is consistent and satisfies the bubbling property. In this section, we show that we can always change the orientation of some cells in G(S, A τ ) and transfer Q to a primitive Euler-partition. We shall use A and Λ instead of A τ and Λ τ , since the permutation τ is fixed in this section. Our goal is to prove the following: then there exist an orientation vector β such that we can construct a consistent and primitive Euler-partition P = P 1 + · · · + P m of G(S, A, β). Moreover, P contains pure cells whenever Q does.

Classification of cells
We call the initial edges and terminate edges of the trails Q 1 , . . . , Q m special edges; there are 2m special edges. We say a trail visits a cell, if they have common edges. Let i ∈ Σ = {1, . . . , N}. We call S i (Λ) a special cell, if it contains special edges. We call S i (Λ) a pure cell, a bi-partition cell, or a poly-partition cell if it is visited by one, two or more than two members of {Q k ; 1 k m}.
Take a cell S i (Λ), let Q = e 1 + L 1 + e 2 + L 2 + · · · + e m + L m (10.2) be the outpath decomposition of Q w.r.t. S i (Λ). Proof. If S i (Λ) is pure, that is, it is a subset of one Q j , then both sides of (10.3) equal 1. Now suppose S i (Λ) is not pure. If Q j visits S i (Λ), then Q j visits exactly two L j which contain special edges. On the other hand, if an outpath L j contains special edges, then it intersects exactly two of Q j visiting S i (Λ). The lemma is proved. (If one boy shakes hands exactly with two girls and one girl shakes hands exactly with two boys, then the number of boys and the number of girls are the same.) □ Now we estimate the number of poly-partition cells.

Lemma 10.2. The number of poly-partition cells is less than
Let S i (Λ) and S j (Λ) be two poly-partition cells, that is, #κ(i), #κ( j) 3.
Let L be the outpath of S i (Λ) containing the cell S j (Λ). Then there exist two edges e h and e h+1 in the cell S i (Λ) such that is a subtrail of Q. Hence, if Q k visits both the S i -cell and the closed trail L, then it contains at least one of e h and e h+1 . This implies that at most two elements of {Q k ; k ∈ κ(i)}, visit L. Therefore κ(i) and κ( j) share at most two elements. It follows that the smallest three elements of κ(i) and that of κ( j) cannot be the same. The lemma is proved. □

Kingdom of a non-special bi-partition cell
Let S i (Λ) be a non-special bi-partition cell, then S i (Λ) is visited by two elements in {Q j ; 1 j m}, say, Q k and Q k . By lemma 10.1, exactly two outpaths of S i (Λ), denoted by L and L , contain special edges. Then the Euler tour Q has the following decomposition: We call D ∪ D the S i (Λ)-kingdom, and call D + D the partition of the S i (Λ)-kingdom. (See figure 16.) The following lemma is obvious. The trails Q k , also Q k , are cut into three parts by L and L , and we denote the three parts by  Proof. Since S i (Λ) is a bi-partition cell, Q can be written as The cell S j (Λ) does not belong to the S i -kingdom since it is not pure (see lemma 10.3), so S j (Λ) must belong to one of L and L . Let us assume that S j (Λ) ⊂ L without loss of generality. Then is a closed subtrail of Q not intersecting S j (Λ). So Q \ L must belong to an outpath L * w.r.t. S j (Λ). Now L * contains special edges since L ⊂ L * , so it does not belong to the S j -kingdom, and Q can be written as Q = L * ∪ (S j -kingdom) ∪L * * . It follows that the S i -kingdom, as a subset of L * , does not intersect the S j -kingdom. The lemma is proved. □

Operation cells
First, let us reformulate the notion of primitivity. Let Q be an Euler-partition. We construct a graph G Q as follows: the vertex set is {1, If V = ∅, then T(Q) is a complete graph and clearly Q is primitive. So we assume that V = ∅. Let k 0 be the minimal element of V .
For each k ∈ V , we select a pure cell contained in Q k , and call it the protected cell, or a black cell, of Q k . It is possible that this black cell is contained in a S j -kingdom. If this happens, then we call S j (Λ) an indirectly protected cell, or grey cell, associated with Q k . (In this case S j (Λ) is a non-special bi-partition cell.) By the disjointness of kingdoms, there is at most one grey cell associated with Q k . So there are at most #V grey cells.
For k ∈ V , Q k only visits bi-partition cells and poly-partition cells; we shall choose operation cells among the bi-partition cells which are non-special and not grey. The lemma below estimates the number of such cells. Let |Q j | be the length of Q j , i.e. the number of edges in Q j . By the above lemma, we can choose r non-special, not grey, bi-partition cells such that Q k0 (where k 0 = min V ) visits the first m of them, and for the other k ∈ V , each Q k visits a different cell in T m+1 , . . . , T r. We call the cells in (10.6) operation cells. In other words, we associate with k 0 the first m operation cells, and for each k ∈ V \ {k 0 }, we associate with one operation cell.

(v , k )-operation
Let v be an edge of Λ and k ∈ V . Let S (Λ) be an operation cell associated with k, then Q k visits S (Λ); let Q k * be the other element in {Q j ; 1 j m} visiting the cell S (Λ). We do a (v, k)-operation as follows.
Let D + D * be the partition of the S -kingdom. By (10.4), Q k and Q k * can be written as If S (v) belongs to Q k , the v-operation is a null operation, that is, we do nothing; otherwise, the v-operation is to construct a new Euler-partition Q = Q 1 + · · · + Q m by exchanging D and D * , and reverse them. Precisely, we set   Then the following statements (i)-(iv) hold: (i) Q is an Euler tour in G(S, A, β ) where β is obtained by changing the orientation of all the cells in the S -kingdom. (Since an edge is reversed if and only it belongs to S -kingdom.) (ii) Q contains pure cells if Q does; (The protected cell of Q j , which is pure, still belongs to Q j since the operation does not change any protected cell.) (iii) Q is still consistent since Q k and Q k have the same initial and terminate points for all does not belong to Q k , then it must appear in D * . After operation, S (v −1 ) belongs to Q k .) Now we can proof the main theorem of this section. Proof of theorem 10.1. Write Λ = v 1 + · · · + v m . For j = 1, . . . , m, we do (v j , k 0 )-operation to the j th cell in (10.6), which are operation cells associated with the minimal element k 0 in V . For the operation cells associated to the indices k ∈ V \ {k 0 }, we do the (v k0 , k)-operation. We can do these r operations consecutively, since the operation cells belonging to the kingdoms are disjoint. Let Q = Q 1 + · · · Q m be the resulted Euler-partition after doing all the operations. First, Q is an Euler-partition of G (S, A, β ), where β is obtained by changing the orientations of the cells in the kingdoms which are involved in the operations.
Secondly, Q is consistent, since all the operations do not change the origins and terminates of the partition.
Finally, the pure cell property is clearly preserved. The theorem is proved. □

Proof of theorem 1.3
In this section, we prove theorem 1.3. We consider two cases according to the behaviour of the Hata graphs H(S n , A), n 1: if H(S n , A) is not a chain for some n 1, then we show that K admits SFCs constructed by the Euler-tour method; otherwise, S is a self-similar zipper.
A graph with n vertices is a chain if there exists an order x 1 , . . . , x n of the vertices such that there is exactly one edge between x i and x j if |i − j| = 1, and there is no edge otherwise. In this case, we use (x 1 , . . . , x n ) to indicate the chain, and we regard the chain as a trail with origin x 1 and terminus x n .
be an IFS satisfying the OSC. Suppose that S has skeleton A and the Hata graph H(S k , A) (k 1) is not always a chain. Then there exist an integer n, a permutation τ of {1, . . . , m}, a vector β ∈ {−1, 1} N n and an Euler-partition P = P 1 + · · · + P m of G(S n , A τ , β) such that P is consistent, primitive and contains pure cells.
Proof. Let n 1 be an integer such that the Hata graph H(S n1 , A) is not a chain. By theorem 9.1, there exist an integer n 2 and a permutation τ on {1, . . . , m}, and an Euler-partition Q = Q 1 + · · · + Q m of G(S n1n2 , A τ ) such that Q is consistent and satisfies the bubbling property. Moreover, Q contains more than 3 unbroken cells by remark 9.3. We choose large enough such that 2 > 2m and Q , the th iteration of Q, satisfies the inequality (10.1) holds. Notice that Q is still consistent and satisfies the bubbling property. So Q satisfies all conditions of theorem 10.1. Therefore, there exist an orientation vector β, and an Euler-partition P = P 1 + · · · + P m of G(S n1n2 , A τ , β) such that P is consistent and primitive.
Finally, we show that P contains pure cells. Since 2 > 2m, by lemma 9.2 (iii), Q contains more than 2m unbroken cells. Since there are only 2m special edges in the Euler-partition Q , there exists an unbroken cell which contains no special edge and it must be a pure cell of Q . Again by theorem 10.1, P also contains pure cells. The theorem is proved. □ Theorem 11.2. Let S = {S i } N i=1 be an IFS with connected invariant set K satisfying the OSC. Suppose that A is a skeleton of K such that the Hata graph H(S n , A) is a chain for every n 1, then an arrangement of {S i } N i=1 is a self-similar zipper.
Using (β 1 , . . . , β N ), we define the following ordered GIFS: Let (V, Γ) be the basic graph of the above GIFS, then V = {E 1 , E −1 }; the j th edge from E 1 is an edge from E 1 to E βj with similitude S j , which we denote by (E 1 , S j , j, E βj ); the j th edge starting from E −1 goes to E −βN−j+1 and has similitude S N−j +1 , which we denote by (E −1 , S N−j+1 , j, E −βN−j+1 ).
By theorem 6.2, to prove the theorem, we need only prove (11.3) is a linear GIFS. Let G n be the sequence of trails with length n in the graph Γ emanating from the state E 1 , arranged in the increasing order. Notice that for each trails in G n , the associated contraction has the form S I with |I| = n, and for different trails, the associated contractions are distinct. So, we replace each trail in G n by the associated contraction and further more replace S I by the word I, then we obtain a sequence which is a permutation of Σ n . For simplicity, we still denote this sequence by G n . Similarly, we denote by G n the sequence of trails in the graph emanating from the state E −1 , arranged in the increasing order. We apply the same simplification to G n .
We claim that, for every n 1, it holds that G n = (1G n−1 ) β1 + · · · + (NG n−1 ) βN (11.4) and G n = G −1 n . We prove by induction on n. Let us consider the words in G n initialed by j . If β j = 1, then after one step, we are still in the state E 1 , hence the arrangement of such words in increasing order is jG n−1 ; if β j = −1, we switch to the state E −1 after one step, and the corresponding arrangement is jG n−1 = j(G n−1 ) −1 . Therefore, G n = (1G n−1 ) β1 + (2G n−1 ) β2 + · · · + (NG n−1 ) βN .
The claim is proved. Comparing (11.2) and (11.4), we obtain that G n = H n for all n 1. Hence, if I and I are two adjacent words in G n (or in G n ), then they are also adjacent in H n , so  A) is alway a chain, then K can be generated by a self-similar zipper by theorem 11.2, and hence admits a SFC.
If H(S n , A) is not alway a chain, by theorem 11.1, there exists a integer k such that an Euler-partition of G(S k , A, β) satisfying the conditions in theorem 8.2. Hence the invariant set of S k , which is also K, admits a SFC constructed by the Euler-tour method. □