8
Vol. 1 No. 2 JOURNAL OF ELECTRONICS Apr. 1984 ENUMERATING ALL HAMILTONIAN CYCLES IN SOME GRAPHS BY USING THE GENERALIZED FIBONACCI SEQUENCE AND ITS PRODUCTION RULE Jin Suigeng (~ ~) (Shanghai Institute of Metallurgy, Academia Sinica) Abstract In this paper, the Fibonacci sequenceis first generalized,and then the algorithmproposed by the author is developed. Both production and recursion formulas describing the algorithm are ob- tained. Thentwo expressionsfor enumeratingall Hamiltoniancyclesin the two kinds of maximum planar graphs are derived for the first time. I. Introduction The enumeration of Hamilton]an cycles in a given graph is an unsolved problemtl,~L The number of Hamiltonian cycles M(p) in the Wagner graphs having p points can be givel~ in the following formraJ: M(p)=4p--14, 5~<P~<20. (1) This expression has been obtained from the data of computer calculation. It remains un- known whether the expression is still true for any p greater than twenty. For another kind of maximum planar graphs, as shown in Fig. l, the relation between p and the number N(p) of Hamilton]an cycles, which were computed by the same program as that in[3], is rather complex, as shown in Tab. 1. Whether there exists an explicit function like Eq. (1) between p and N(p) remains a problem. Solutions to these two problems will be given in the paper. In section II, the Fibonacci series will be generalized. In section IV, the recursion algorithm of [3] i& O) (b) (r Fig. l

Enumerating all hamiltonian cycles in some graphs by using the generalized fibonacci sequence and its production rule

Embed Size (px)

Citation preview

Vol. 1 No. 2 JOURNAL OF ELECTRONICS Apr. 1984

ENUMERATING ALL HAMILTONIAN CYCLES

IN SOME G R A P H S B Y USING THE GENERALIZED

FIBONACCI SEQUENCE AND ITS

PRODUCTION RULE

Jin Suigeng ( ~ ~ )

(Shanghai Institute of Metallurgy, Academia Sinica)

Abstract

In this paper, the Fibonacci sequence is first generalized, and then the algorithm proposed by the author is developed. Both production and recursion formulas describing the algorithm are ob- tained. Then two expressions for enumerating all Hamiltonian cycles in the two kinds of maximum planar graphs are derived for the first time.

I. Introduction

The enumeration of Hamilton]an cycles in a given graph is an unsolved problemtl,~L The number of Hamiltonian cycles M(p) in the Wagner graphs having p points can be givel~ in the following formraJ:

M ( p ) = 4 p - - 1 4 , 5~<P~<20. ( 1 )

This expression has been obtained from the data of computer calculation. It remains un- known whether the expression is still true for any p greater than twenty. For another kind o f maximum planar graphs, as shown in Fig. l, the relation between p and the number N(p) of Hamilton]an cycles, which were computed by the same program as that in[3], is rather complex, as shown in Tab. 1. Whether there exists an explicit function like Eq. (1) between p and N(p) remains a problem. Solutions to these two problems will be given in the paper. In section II, the Fibonacci series will be generalized. In section IV, the recursion algorithm of [3] i&

O) (b) (r

Fig. l

100 J O U R N A L O F E L E C T R O N I C S Vol. 1

Tab. 1

P

N(p)

E r',- v,. r:, z~

vW~ vo- 1:~ vl

vW,- re0- v'~ v~

v~v~v,

vl VW," Vo" V, v, I"

V, V~ Vs" V~ V, Vl

vW~ v~ v~

VW~ v," v," v, v,

VW, V~176

vW, v:v,v,v~

6

vW~ v, ~'5. v,. v, E

v d : v~ v,. v, z~

vW~ vW,. v~ v, v~

tzWWW, Vo.V,v~

10

7 8

v, e0 e5 ...

17 31

9 10

57 104 188

11 12

340

developed with the aid of the generalized Fibonacci series. Both production and recursion for-

mulas for the description of the algorithm are obtained. Then the two expressions enumerat- ing Hamiltonian cycles in the above two kinds of maximum planar graphs were derived for the first time.

Except those that will be explained specifically, the graphic terms and symbols used here can be referred to [1].

II. Prel iminary R e m a r k s The General ized Fibonacci Series

The following infinite series: 0, 1, 1, 2, 3, 5, 8 . . . . is called the Fibonacci series and denoted by <f,~). There are many applications of <f,> in the study of computer algorithm. Each number in the series is the sum of its two predecessors. If the nth number of the series is denoted by f~, the series can be expressed as follows:

fo=0j <2) A=f~_l+f, ,_s, n=2, 3, 4, . . . . ( 3 )

Eq. (2) gives the initial values of the series, and Eq. (3) is called the general term formula. It is obvious that the initial values and the general term formula determine the series completely.

The Fibonacci series has been generalized many timest~,s]. Perhaps the following at- tempted generalized Fibonaeci series is the most general one. Not only (f~) and its existing generalized forms, but also the series <A) used later in the paper is included in this most general one as its special forms.

Definition* The series which is determined by the initial values

to=10, f i = l x , "", t , _ l = I , , - x ( 4 ) with the general term

* According to [6] (page 407), J. D. Cassini or A, de Moive possibly dealt with a similar series in the 17th or 18th century respectively, but the author could not find their original papexs.

No. 2 ENUMERATING ALL HAMILTONIAlq CYCLES IN SOME GRAPHS I01

f i t

t , ~ = ~ y d n _ o n = m , r e + l , m+~, . - - i ' l

( 5 )

is called the generalized Fibonacci series and denoted by (t~). Where m is a positive integer and is called the order of the series, and n is also a positive integer. The values of n ~ can be taken from m to infinity, le,/1 . . . . . Im-x and Yl, Y2 . . . . . y~, are the 2m constants. If

m----2, Io=0, Ix-----1 and y x = y ~ = l , ( 6 )

then (t~) becomes ( f , ) . The fifth-order generalized Fibonacci number quoted from page 269 of [5] is also a special example of this definition.

Let the power series

G ( Z ) = ~ t , Z ~ ( 7 )

be the generating function of ( t .) . An analytic expression in the closed form for G(Z) can be derived by some simple algebraic operations:

m - 1 t "~E t ~ - ( ~ y d ~ _ j ) 3Z ~ ~-o J - x

G ( Z ) ----- , ( 8 )

( 1 - - ' ~ y , Z ~)

t where j.~ 1 (Yo tt-~) = 0 when i ~ j .

Substituting Eq. (6) into Eq. (8), one obtains

Z G ( Z ) =

I _ Z _ Z ~ �9

This is the generating function of (f~) in the closed form.

m . The Details of the Problem

In the following, the term "graph" sometimes means the labeled maximum planar graph and the term "cycle" sometimes means the Hamiltonian cycle for brevity. Vertices in a graph are denoted by vl, vs . . . . , vp, where p is the number of vertices (or p is the order) of the graph. According to [3], the graphs listed in Fig. I axe obtained as follows:

From p=4 , the ( p + 1)th order graph is obtained from the pth order graph by adding a vertex vp+ 1 into the triangular face which has three vertices vp, v~_~ and vp_ t on its three cor- ners and connecting vp+ 1 to v , vp_ 1 and vr_ 2 by three edges respectively. When p=4 , 5 and 6 the graphs obtained are shown in Fig. 1. According to [3], if one wishes to obtain the set ~ '~(p+ 1) of all Hamiltonian cycles in the (p+ l ) th order, it is necessary to check each cycle in the set .~ ' (p) of all Hamiltonian cycles in the pth order graph. If one or two of the three edges

102 JOURNAL OF ELECTRONICS Vol. 1

v~v~,_ v v~,v~_ s and v~,_x~,~,_ ~ are found in a certain Hamiltonian cycle, inserting v~+ x between the two endpoints of the edSe, one can get one or two new Hamiltonian cycles of the ~ ( p + 1). After every Hamiltonian cycle is checked up in this way, the new set ,cg~(p+ 1) of Hamiltonian cycles is obtained. For example, there are two edges vsv . and ~sv~ in the cycle v~v~v'~v4v ~ of ~ " ( 4 ) in Tab. 1. To make them recognizable easily, two dots " . " are put on these edges. If ~5 is inserted between h and v a or r s and v, respectively, a new Hamiltonian cycle v~v2v~vjvd~

or v~v~vave~,,v ~ of,L~e'(5) is obtained. Whenp-- 6 only 4 cycles are listed in Table 1, the remaining 6 cycles are dropped to save space. All cycles of the graphs w i t h p ~ 6 are also dropped to make the table look shorter.

IV. The Solution of the Problem

For the sake of convenience, the general algorithm in [3] will be briefly repeated here. What has been just mentioned above is a specific application of the following general algorithm.

1. The (p+ l ) th order maximum planar graph is obtained as follows: First a vertex v~+ 1 is added to a certain triangular face with three vertices vi, v~ and vk as its three comers in the pth order maximum planar graph, then connect vp§ to v~, v~ and v t by edges v,v~§ x, vjvp§ 1 and vkvp§ 1 respectively.

2. In order to get all Hamiltonian cycles of ,~'(p-l- 1), it is necessary to check each cycle in ~ ' ( p ) . If one or two of the three edges v~v~, v~h and ~tv~ are found in some cycles, inserting vp+ 1 between the two endpoints of each edge, one will get one or two new Hamiltonian cycles of ~L~f'(p+ 1). After every cycle is checked up in this way, the new set of all Hamiltonian cycles in the ( p + 1)th order graph is obtained (the details of the algorithm and its proof can be found in [3]).

According to the algorithm, it is easy to see that if v~+l is inserted into a certain cycle, the way in which the three vertices v~, vj and vt appear in the cycle must be one of the five com- binatorial cases: BS (or SB), it means that the edge v~v~ or vdk appears in the cycle; supposing i ~ j ~ k holds, then i is the Small one and k is the Big one. In BM (or MB), it means that both the Big one and the Median one appear together. For SBM (or MBS), the explanation is similar to the above and is dropped later on. Take SMB (or BMS) and MSB (or BSM). The case SM (or MS) cannot be met because the Big one must appear. For brevity, these 5 cases are denoted by ,4, B, C, D and E in sequence. For the graphs shown in Fig. 1, after v~,+l is inserted, these cases will be changed according to the following production formulas:

,4-~B (reads as ,4 becomes B, etc.), (9.1) B~c , (9.2) c ~ c + D , (9.3) D--.C + E, (9.4) E--,.A+B. (9.5)

For the graph shown in Fig. 1 (a), the three Hamiltonian cycles of ~f ' (4) belong to C, D and E cases respectively. Hence the sets ~ ( 5 ) , ~#'(6) and ~" (7 ) can be generated by Eq. (9) and are listed in Tab. 2.

No. 2 ENUMERATING ALL HAMILTON[AN CYCLES IN SOME GRAPHS 103

Tab. 2

~ ' ( p ) Components of ~ ' ( p ) N(p) = ]~'(P)I

~ ' ( 4 )

~,,'(5) . ,~(6)

.L)t"(8~ , ~ (9 )

,~(11) ,~'(12)

0-A

1-A

1.A

1.A

2.A

4.A

8.A

14.A

25-A

0-B

1.B

2.B

2.B

3.B

6.B

1-C

2-C

4-C

8.C

14-C

25-C

1-D

1.D

2.D

4.D

8.D

14-D

1-E

1-E

1-E

2-E

4.E

8.E

12.B

22.B

39-B

45.C

82- C

149- C

25.D

45-D

82-D

14.E

25-E

45-E

3

6

10

17

31

57

104

188

340

Denoting the coefficient of A, B, C, D and E of the pth order graph by a n, bp, cp, de and ep, one can obtain the following set of recursion formulas according to Eq. (9):

an----ee-x, b,=av-x-{-e,_l, c~=b,_x@c,_x-l-d,-1, d,=c7,_1, e~=d~_]. By simple algebraic operation one can derive the following equations from these formulas

en=ep_l +ep_~aUep_4-J-en_5, p=9, 10,---1 (10)

N(p)=2(en+i-}-ep+ep_x+e~,_s)arev-s, p----7, 8,..-, (11)

where N(p)=ap+bpd-c~nt-dp-}-e~, is the total number of Hamiltonian cycles in the pth order graph.

The general terms Eq. (10) and the following initial values

e ~ = e s = e 6 = l , e:=2, e s = 4 (12)

determine a certain generalized Fibonacci series completely

1, 1 ,1 ,2 , 4, 8 ,14, 25, . . . . (13)

To simplify the digital computation, the general term is changed into the foUowing form:

.~+5=J,+t+J,+3+J.+l+J,, n = 0 , 1,..-. (14)

Accordingly the initial values are

h-----Jl-----J2=l, A = 2 , h-----4. (15) Then the series is denoted by <A}. Obviously, there is a one to one corresponding relation

between <A} and (ep), for example, A to e L, A to e 5 and soon. If we let m = 5 , to=h=tz=l, 13-----2, t4:-4; y1----y3:yt=y6=landys:O in Eqs. (4)

and (5), then ( t . ) becomes <A}. Hence the generating function of ( A ) in dosed form can be obtained by substituting these values into Eq. (8):

1 - - Z t G(Z) -~ I__Z__Z2__Z~__Zs.

From this equation its convergence radius can be determined.

Eq. (14) is a fifth order homogeneous difference equation with constant coefficient. Ao- cording to [7], its indicial equation is

104 JOURNAL OF ELECTRONICS Vol. 1

X6-- .X4- - .Xs - - X - - 1 ~ 0 .

This fifth degree polynomial equation has 5 different roots which are calculated ap- proximately on a digital computer:

xl=1.8124,

xz=0.3435+i0.8635,

xa=0.3435--i0.8635,

x , = --0.7497+ i0.2770,

xs= --0.7497--i0.2770.

Then the general solution of Eq. (14) is

(16.1) (16.2) (16.3) (16.4) (16.5)

5 j,,='~k,x'~, n--O, 1, 2,- .- , (17)

i - 1

where k a . . . . , kj are the constants which can be determined by the first five initial values o f Eq. (15)

li ~_jk~= l, (18.1) i - 1

6 ~..ktx~= 1, (18.2)

5 ~.k~x~*----- 1, (18.3)

5 '~.k~x~a=2, (18.4)

5 52kixi*= 4. ( I8 .5 ) i - 1

This system of linear equations with complex coefficients has been solved by the Gauss elimination method on a computer as follows:

kx=O. 2476+/0.7753,

k2=O. 2476--i0.7753,

ka=0.0578+i0.1395,

k, = 0.0578-- i0.1395,

k5:0.3892.

(19.1)

(19.2)

(19.3)

(19.4)

(19.5)

Eqs. (16), (I7) and (19) determine (j~) uniquely. According to the correspondence relation of (&) and (ep), we obtain

5 %=~kcxtP-4, p = 9 , 10, "'" (20)

i - 1

and the number of all Hamiltonian cycles in the pth order graphs is

5 N(p)='~F(k~x~), (21.1)

i - 1

No. 2 E N U M E R A T I N G ALL H A M I L T O N I A N CYCLES IN SOME GRAPHS 105

where

5 F(k~xi)-~2('~kix~P-s-Z)--k6x6 ~-~, P~-7, 8,"-. (21.2)

1 - 1

Eq. (21) is the enumerating formula of the Hamiltonian cycles of the pth order maximum planar graph in Fig. 1, where the values of xt and kt axe given by Eqs. (16) and (19) respec- tively.

I ra set of N(p) values for F ~ k , k--I-l, k--l-2 . . . . is wanted, it is convenient to use Eqs. (11), (12) and (13). For p = 4 to 12, the values of N(p) determined by using these equations are the same as those which are computed by the algorithm. They are listed in Tab. 1. Those for p=13 to 25 are listed in Tab. 3. If ep and N(p) axe computed from Eqs. (16), (19), (20) and (21) for some p>~9, neglecting the computation error, the results are in accord with those in Tab. 1 and Tab. 3.

Tab. 3

p 13 14 15 16 17 18 19 20

e~ 82 149 270 489 886 1 6 0 6 2911 5276

N(p) 616 1117 2025 3670 6651 12054 21847 39596

21 22 23 24 25

9562 17330 31409 56926 103173

71764 130065 235730 427238 774328

Similar analysis can be made for the Wagner graphs in [3]. The two of the three vertices of the triangular face in which the vertex vp+ x is added are fixed on v s and v 3, therefore the three vertices which appear in the Hamiltonian cycles are in one of the following four cases: BS, BM, SBM and SMB. They are denoted by A', B', C' and D' in sequence.

Another set of production rules is obtained according to the generation rule of the. Wagner graphs:

A'--~ A', B'---~B', C'--~C' + D', D'--~A" + B'.

The set of all Hamiltonian cycles in the fifth order Wagner graph consists of 1.A', 1.B', 2.C' and 2.D'. Using similar symbols in the coefficients, we obtain the recursion formulas for p>~5 as follows:

Hence the total number of Hamiltonian cycles in the (p+ 1)th Wagner graph satisfies the following difference equation:

M ( p + 1)-~M(p) + 4 . (22)

This constant coefficient difference equation is non-homogeneous and of first order. It ca~ be solved by a simple method. According to page 16 in [7], its homogeneous indicial equation has a single root 1. Therefore the general solution of Eq. (22) is

M(p) = A p + B . (23)

Substituting the initial values M(5)~6 and M(6)= 10 in it, one is able to determine the arbitrary constants A and B as follows:

A=4, B-- -- 14.

106 JOURNAL OF ELECTRONICS Vol. I

Substituting these values in Eq. (22), one can obtain the same equation as Eq. (1). In this

way, Eq. (1) is proved to be true for any integer p~>5.

Hakimi and Schmeichel conjecturedtS~ that the upper bound of the total number of

Hamiltonian cycles in the maximum planar graph is 2 ~. For the graphs discussed here

the upper bound o f Hamiltonian cycles is about (1.8) p. Their conjecture is in accord with our

result.

References

[1] F. Harary ~ , ~ i ~ , ~ , • 1980. [2] J. C. ]]c~'molld, ]-]mnni|tonian Graph, in Selected Topics in Graph Theory, ed. by L. W. Bcineke and R. J.

Wilson, Academic Press, N.Y., 1978, p. 162.

[4] D. E. Knuth ~:, ~ : ~ . . ~ _ _ ~ , ~ ; [ - ~ F ~ J ~ ' 5 , ~ : E ~ : , 1980. [5] D. E. Knuth, The Art of Computer Progr~nming, Vol. 3, AddisonoWesley, Reading Mass., 1973. [6] L. E. Dickson, History of the Theory of Numbers, Vol. 1, Chelsea, N. Y., 1952. [7] E. S. Page and L. B. Wilson, An Introduction to Computational Combinatorics, Cambridge Univcrs/ty

Press, Cambridge, 1979. [8] S. L. Hakimi and E. F. Schmeichel, J. of Graph Theory, 3 (1979), 69.