• No results found

Combinatorial algorithms on partially ordered sets

N/A
N/A
Protected

Academic year: 2021

Share "Combinatorial algorithms on partially ordered sets"

Copied!
116
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

A C C E P T E D

by

f AC U L I Y OF O H HO U A I t STUCIO& Y a su n o ri K o d a

M .M ath ., U niversity o f W aterloo, 1987

■ i .... — —

7 V i / ! Di-AN

A D isserta tio n S ub m itted in P a rtia l Fulfillm ent of tlie

oft re M - l s I . R equirem ents for th e Degree of

D O C T O R O F P H IL O S O P H Y in th e D ep artm en t of C o m p u te r Science

We accept th is thesis as conform ing to th e required sta n d a rd

Dr. M . It . Fellows, S upervisor (D e p artm en t o f C o m p u ter Science)

^— | y f | i - y r ~m—fc

l)r. J. A. EllisfTDfpagtetier^al M em ber (D e p artm en t of C o m p u ter Science)

Dr. W . J . M y ?v 5 ltf, D e p artm en tal M em ber (D e p a rtm e n t of C o m p u te r S cence)

Dr. It. Odeli, O utside M em ber (D e p artm en t of M ath em atics)

Dr. It. C. R ead, E x tern al E xam iner (D e p a rtm e n t of C om binatorics an d O p tim izatio n , U niversity of W aterloo)

© Y A SU N O R I K O D A , 1991 U niversity of V icto ria

All rig h ts reserved. T hesis m ay no t be rep ro d u ced in w hole or in p a r t, by m im eograph o r o th e r m eans, w ithout th e perm ission of th e a u th o r.

(2)

11

Supervisor: Dr. M ichael Fellows

A b str a c t

T h e m ain results of this d issertatio n are various algorithm s re la ted to p artia lly ordered sets. T h e d isse rta t'o n basically consists of two p a rts. T h e first p a rt tre a ts algorithm s th a t g enerate ideals of p artially ordered sets. T h e second p a rt concerns th e generation of partially ordered sets them selves.

F irst, we p re sen t two algorithm s for listing ideals of a forest poset. T hese algorithm s g enerate ideals in a G ray C ode m anner; th a t is, consecutive ideals differ b y exactly one elem ent. B oth algorithm s use storage O (n ), where n is th e n u m b er of elem ents in th e poset. T h e first alg o iith m traverses, a t each phase, th e c u rre n t ideal being listed and runs in tim e 0 ( n N ) , where 11 is th e n u m b er of ideals of th e po set. T h e second algorithm mimics th e first b u t elim inates th e trav e rsal and runs in tim e 0 ( N ) . T his algorithm has the p ro p e rty th a t th e am ount of co m p u tatio n betw een successive ideals is 0 ( 1).

Secondly, we give orderly algorithm s for constru ctin g acyclic digraphs, acyclic tr a n ­ sitive digraphs, finite topologies and finite lattices. For th e first tim e we show th a t th e n u m b er of finite lattices on 11, 12, and 13 elem ents are 37622, 262775, an d 2018442, re­ spectively, and the num ber of finite topologies on 8 an d 9 elem ents are 35979 an d 363083, respectively.

We also describe orderly algorithm s for generating fc-colored graphs. W e p resent, in p artic u la r, an algorithm for generating connected bicolorable graphs. W e also prove some properties of a canonic m atrix which m ight be generally useful for im proving th e efficiency of orderly algorithm s.

(3)

Dr. M . R . Fellows, S upervisor (D e p a rtm e n t of C o m puter Science)

Dr. J . A . E llis y U e ila i'trte n f^ M e m b e r (D e p a rtm e n t o f C om p u ter Science)

Dr. W . J . M yrvold , D e p a rtm e n ta l M em ber (D e p a rtm e n t of C o m p u ter Science)

Dr. R. O deh, O u tsid e M em ber (D e p a rtm e n t of M a tlie m n tic ;)

Dr. R. C . R ead, E x te rn a l E x am in er (D e p a rtm e n t of C om binatorics and O ptim ization, U niversity of W aterlo o )

(4)

A ck n o w le d g e m e n ts

George P olya said th a t new knowledge is obtained th ro u g h in d u ctio n (in th e ordinary English sense). T h is thesis contains new knowledge acquired th ro u g h observation and induction.

I w ould like to express m y th an k s to Prof. M ike Fellows for his careful supervision on this dissertation.

I would like to express m y special th an k s to Prof. R on R ead for in tro d u cin g me to the problem s, and continuous su p p o rt and encouragem ent for solving th e problem s. M y research in this thesis was actually sta rte d when I was a t th e U niversity of W aterloo.

1 would like to express my th an k s to P rof. Teofilo G onzalez for n o t providing me any hints except saying th a t if we try th e sm all cases, we can generalize an d figure o u t the solution. His teach in g gave m e a sense of th e research a ttitu d e .

I would like to express m y th an k s to P rof. F ran k H a rary for providing me w ith the o p p o rtu n ity to solve grap h problem s in his enjoyable courses and to D r. H e ath er Silverm an for providing me th e tim e to discuss m y fu tu re p a tie n tly an d logically.

I owe final th an k s to m y p aren ts and m y bro th ers for encouragem ent to continue m y research.

(5)

C o n te n ts

A b s tr a c t A c k n o w le d g e m e n ts C o n t e n t s L is t o f F ig u r e s L is t o f T a b le s 1 I n tr o d u c t io n 1.1 T h e P r o b le m s ... 1.2 A G ray C o d e ... 1.3 O rderly A lg o rith m s ...

1.4 Previous W ork and A pplications

1.5 O v e r v i e w ... 2 M a t h e m a t ic a l P r e lim in a r ie s ii iv v v ii x 1 1 5 (j 11 13 1 4

(6)

C O N T E N T S vi

3 F o r e s t P o s e t id e a ls 21

2.1 I n tro d u c tio n ... 21

3.2 T h e Elirlich and U E It A lg o rith m s...22

3.3 T h e Existence of a G ray C ode of Lower Ideals of a Forest P o s e t ...

2-3.1 A lgorithm P ... 26

3.5 T h e Ideals G enerated by A lgorithm P ...29

4 L o c p le s s G e n e r a t i o n o f F o r e s t P o s e t I d e a l s 33 •1.1 M otivation ...33

4.2 T h e B inary Reflected G ray C o d e ... 34

4.3 T h e A l g o r i t h m ... 36 4.4 T h e V alidity of A lgorithm L ... 41 4.5 T h e Looplessness of A lgorithm L ... 44 4.0 A p p l i c a t i o n ...47 5 A c y c lic D i g r a p h G e n e r a t i o n 48 5.1 In tr o d u c tio n ...48

5.2 Acyclic D igraph R e p re s e n ta tio n ... 49

5.3 A ugm entation of an Acyclic D i g r a p h ...51

5.4 G enerating Acyclic D igraphs... 53

5.5 Acyclic T ransitive D i g r a p h s ... 58

5.6 F in ite L attices and S e m ila ttic e s ... 58

5.7 F in ite T o p o lo g ie s ...61

(7)

6.1 In tr o d u c tio n ... yj

6.2 P ro p erties of a C anonic V e c t o r ... 71

6.3 A'-Colored G raph G e n e r a t i o n ... 73

6.4 G enerating Bicolored and A'-Colored G r a p h s ... 70

6.5 T h e C anonicity T est and th e C anonic M a t r i x ... S2

6 .6 T h e O rderly A lgorithm R e v is ite d ...,S 1

7 C o n c lu s io n s a n d F u tu r e R e s e a r c h g j 7.1 C o n c lu s io n s ... ^7 7.1.1 Ideal G e n e r a t i o n ... H7 7.1.2 G ra p h G e n e r a t i o n ... 7.2 F u tu re R esearch ... X8 7.2.1 Ideals G e n e ra tio n ... g# 7.2.2 G ra p h G e n e r a t i o n ... X9 A A n E x a m p le o f I d e a l G e n e r a tio n fo r a T r e e P o s e t 96

B T h e B E R A lg o r ith m for G e n e r a t in g a B in a r y R e fle c t e d G r a y C o d e 98

C T a b le s o f A c y c lic D ig r a p h s , P o s e t s , F in it e L a ttic e s a n d F in it e T o p o lo g ie s 100

(8)

L ist o f F ig u r e s

1.1 G raphs with four v e r t i c e s ... ... 2

1.2 A labeled graph G an d its spanning trees ... 2

1.3 II asse diagram s of finite lattices w ith up to 5 e l e m e n t s ... 3

1.4 B inary reflected codes o f lengths 2 an d 3 ... 3

1.5 A tree poset and its low er ideals ... 4

1.6 G ray code g e n e ra tio n ... 6

1.7 G raph generation by a classical m e t h o d ... 7

1.8 T h e code of a g r a p h ... 7

1.9 G rap h generation by an orderly a l g o r i t h m ... 8

1.10 N ecessary and sufficient conditions for th e existence of orderly algorithm s . 9 2.1 An exam ple of a tran sitiv e d i g r a p h ... 15

2.2 A n exam ple of acyclic d igraph whose vertices are ordered by d istan ce from s o u rc e s ...16

2.3 L.p Four elem ents n o t satisfying the unique bound c o n d itio n ...1.9 3.1 A lgorithm E ... 23

(9)

3.3 A lgorithm P

3.4 A rightm ost p a th in a forest p o s e t ... ... 30

3.5 A p ro p e rty of th e final ideal F ...

4.1 T h e d a ta s tru c tu re for the binary co u n ter a l g o r i t h m ...

4.2 A lgorithm B ...

4.3 T h e useful node list . ... 4.4 A lgorithm L ... 38

4.5 C ase 1. 1. D eletion in th e case not covered by C ase 1 . 2 ... 39 4.6 C ase 1.2. D eletion of th e first free node th a t is th e first sibling while the

rest of th e siblings are null an d s t u c k ... 39

4.7 C ase 2.1. A ugm entation on a node having no c h i l d r e n ... 40

4.8 C ase 2.2 . A ugm entation on a node having c h i l d r e n ... 40

4.9 D a ta stru c tu re s for a node in a forest poset and a node in th e useful node list 45

5.1 A layered acyclic digraph and its m atrix form ...

5.2 T h e canonical acyclic d ig rap h and its c o d e ...

5.o T h e conceptual schem e of a set o flists L{tj ordered by the n u m b er of vertices a n d h e ig h t...

5.4 T w o non-isom orphic acyclic digraphs th a t augm ent to isom orphic digraphs 54

5.5 A n orderly algorithm for generating acyclic d ig rap h s...

5.6 A n exam ple of checking th e unique bound condition for a p o set... 60

5.7 A n exam ple of a tran sd ig ra p h and an equivalent re p resen tatio n by an acyclic tra n sitiv e dig rap h w ith l a b e l i n g ... 61

5.8 A n assignm ent of tw o decom positions o f the n u m b er 10 to th e vertices such th a t th e resu ltin g digraphs are is o m o r p h ic ... 62

(10)

L IST OF F I C V R E S x

5.0 T i m r a n o i i i r i t v lest. ... 7 0

5.10 A p erm u ta tio n vector used for th e canonicity t e s t ... 70

0.1 T h e algorithm for generating bicolored g r a p h s ...78

0.2 T h e algorithm for generating connected bicolorable g r a p h s ...79

0.3 T h e algorithm for generatin g fc-colored g r a p h s ... 81

0.-1 A lgorithm M ...85

A.l T h e enum eration of ideals by A lgorithm P 97 15.1 T h e B EIt alg o rith m for generating a G ray c o d e ...99

(11)

C .l T h e n u m b er of tran sitiv e d ig rap h s... 101

C.2 T h e n u m b er of unlabeled acyclic digraphs w ith i vertices and height j . . . 102

C.3 T h e n u m b er o; unlabeled acyclic tran sitiv e d ig ra p h s ( p o s e ts )... 102

C.4 T h e n u m b er of finite lattices w ith i elem ents an d height j ...103

D .i T h e n u m b er of unlabeled bicolored graphs w ith non-interchangeable color classes of orders i and j ...

D.2 T h e n u m b er of up labeled connected bicolored graphs w ith non-interchangeable color classes of orders i and j ... 105

(12)

C h a p te r 1

I n tr o d u c tio n

1.1

T h e P r o b le m s

This dissertation describes various ipw algorithm s for com binatorial generation. One of the fu ndam ental com binatorial problem s, th e so-called enum eration problem , asks how m any com binatorial configurations th ere are for a given set of p aram eters. E num era­ tion sim ply means to count th e com binatorial configurations for a given set of p aram e­ ters, w hereas generation implies co n stru ctin g th e a c tu a l objects as well as co unting them . Hence, for each en um eration problem , th ere is a corresponding generation problem . In this d issertatio n , we assum e th a t th e re ad er is fam iliar w ith basic term s and concepts in graph theory (see H arary [20]) an d poset (p a rtia lly ordered sat) th eo ry (see S tanley [52]). There a re two kinds of com binatorial enum eration problem s. T h e first ty p e of enum era­ tion problem asks, for exam ple, how m any graphs th ere are for a given n u m b er of vertices (see F igure 1.1), or how m any different ways th ere are to arran g e n d istin ct objects.

T h e second ty p e of enum eration problem asks, for instance, how m any sp anning trees there a re for a given graph (see F igure 1.2), how m any m axim um m atchings th ere are for a given graphs, o r how m any d istin ct in dependent colum n vectors th ere a re for a given m atrix.

In th is thesis, we tre a t the above tw o types o f enum eration problem s. We will fur­ ther ask how to elliciently g enerate those com binatorial objects. In 1960 F rank H arary

(13)

i

i

u

n

k :

Figure 1.1: G raphs w ith four vertices

published a list of 27 unsolved enum eration problem s [18], which has been subsequently u p d ated and revised [19] [21]. A m ong the “surviving” unsolved problem s are th e enum er­ atio n of acyclic tran sitiv e digraphs (o r p artially ordered se ts), finite lattic es, and tran sitiv e digraphs (also known as finite topologies). See Figure 1.3 for a graphical representation of all finite lattic es w ith up to 5 elem ents.

T h e re exists tran sitiv ity am ong th e vertices in acyclic tran sitiv e digraphs, and the graphical forms of finite lattices an d tran sitiv e digraphs. As of y et, there are no known closed an a ly tic form ulae for th e enum eration problem of these dig rap h families involving tran sitiv ity . T h u s, in ord er to c o u n t those graphs we have to reso rt to a constructive m ethod. We use orderly algorithm s to c o n stru c t or to g enerate these graphs. O rderly algorithm s g en e rate a list of th e com binatorial configurations of a given p aram eter value (such as th e n u m b er of vertices or edges) from lists of th e configurations having a sm aller p a ram eter value.

W e will find la te r t h a t the rep resen ta tio n of A:-colored graphs is th e sam e as the

(14)

F igure 1.3: Ilasse diagram s of finite lattices w ith up to 5 elem ents

representation of acyclic tran sitiv e graphs; hence, we can also develop orderly algorithm s to co n stru c t bicolored graphs, and m ore generally fc-colored graphs.

If we represent n d istin ct objects by n binary bits, th a t is, 0 stan d s for th e absence of an o b ject and 1 stan d s for th e presence of an o b ject, all th e subsets of n d istin c t objects arc easily represented by all distinct 2n n —b it strings. O ne of th e m ost efficient ways to generate these n —b it strings is to generate th em a,s a G ra y code. See th e exam ple of a G ray code in F igure 1.4.

0 0

0 0 0

0 1

0 0 1

1 1

O

i l

1 0

0 1 0

1 1

0

1 1 1

1

0

1

1

0 0

Figure 1.4: B inary reflected codes of lengths 2 an d 3

T his G ray code has th e p ro p erty th a t ad jac en t strings in a list have exactly one b it different. A G ray code can be viewed as a linearly ordered set of all com binations chosen from a se t of n un related elem ents ( antichain) such th a t tw o successive com binations differ

(15)

t

t f

V . u v v /

F igure 1.5: A tree poset an d its lower ideals

by one elem ent.

Now, we consider th e m ore general case in w hich the set of elem ents from which a com bination (a code) to be chosen is stru ctu re d . In o u r case, th e elem ents are chosen from a poset V whose H asse diagram is a forest. T he com binations th a t we g enerate are lower ideals o f V .

A low er ideal 7 of a poset V is a subset of V satisfying th e conditions th a t if x 6 I and

y < x , th e n y € I . T h e m inim al elem ent a: of a p o set V is an elem ent of V such th a t there is no elem ent y, y < x. If t le H asse diag ram of "P is a forest J-, th e m inim al elem ents are called th e roots a n d z set of lower ideals p has a one-to-one correspondence w ith the set of subtrees w hich contain th e roots o f V . In th is d issertation, an ideal m eans a lower ideal. A Gray code o f ideals is a linearly ordered se t of ideals such th a t successive ideals differ by a single poset elem ent. In F ig u re 1.5 we show a poset and all its lower ideals. T h e e m p ty set is always an ideal by definition.

W e will describe new efficient algorithm s for generatin g the lower ideals of a forest poset. In o ther w ords, a generalized G ra y code is a list of a n y com binatorial objects with th e sam e p a ram eter in which tw o consecutive ob jects differ by sm all am o u n t of changes of th e elem ents w hich co n stitu te an object. T h u s, we m ay consider a list of lower ideals as a generalized G ray code. Such a generalized G ray code has recently been an actively studied topic in th e area o f com binatorial algorithm s. An excellent survey of recent developm ents concerning various generalized G ray codes is given in W ilf [56].

(16)

5

1.2

A G ray C o d e

An ra-bit Gray code is a n on-repeating sequence of the 2n d istin c t n —b it strings (codew ords) over {(), 1} such th a t successive codewords in th e sequence differ b y th e com plem entation of a single bit. T h e French engineer B audot invented this code as a solution to th e problem of m inim izing e rro r in reading a b in ary telegraph transm ission message. A tra n s m itte r keyboaid em ploying a five digit code was exhibited a t th e U niversal E xposition in P aris in 1878. F or an account of th e work of B audot, see H eath [26]. F ran k G ray [16], ap p a re n tly w ithout knowing th e work of B audot, first published in 1953 a description of th e code for use in p reventing errors in certain signal transm issions [16].

G ra y codes were, in fa ct, known in th e n in etee n th cen tu ry in th e form of a solution to a n u m b er of puzzles such as “T h e Chinese R ing” an d “T h e Tower of H anoi” (See th e paper b y M artin G ardner [13]).

If you consider the n —cube whose vertic s rep resen t all th e b in a ry strings of len g th n and w hose edges connect a pair of vertices if th e ir b in ary strings differ by one b it, th en the G ra y code gives a H am iltonian path or cycle in th e n —cube. In fact, an y H am iltonian path in th e n —cube graph gives a G ra y code. C ounting th e H am iltonian cycles an d path s in the n —cube is still an open problem . T h e first w ork on this problem was b y G ilbert [1-1]. T h e most recent results on th e problem a re given in Douglas [10].

G ray codes have num erous im p o rta n t applications in engineering and science. F or a survey see Godclyn et al. [15]. T h ere are m any in terp re tatio n s of a G ray code. Here, we describe a G ray code as a list generated recursively. From F igure 1.4, we can easily deduce th a t a G ra y code of size n can be constructed from o re of size n — 1. L et L n den o te th e list of all n —bit strings, ordered as a binary reflected G ra y code. T h e recursive procedure to c o n stru c t such a B inary Reflected Gray code is sum m arized in F igure 1.6.

N ote th a t in th e algorithm show n in Figure 1.6, a list of sm aller size is read twice, th e second tim e in reverse order. In a la te r ch a p te r, we in tro d u ce th e alg o iith m by E hrlich [11] w hich generates th e code w ith o u t using a list. T h is alg o rith m has been im proved by Ilitn e r, E hrlich and Reingold [4] so th a t th e tim e to d eterm ine th e next codew ord is bounded by sem e co n stan t.

(17)

1. T h e list Lq is em pty.

2. For each n = 1, 2 , . . having o btained L n- 1, then 2.1 w rite out licit T n_ i an d prefix each strin g w ith

a b it “0” ;

2.2 w rite out list Z n_ i in reverse o~der, and prefix each strin g w ith a b it “ 1” ;

3. T h e list L n is th e result of co ncatenating th e tw o lists th a t w ere form ed in step 2 .

F ig u re 1.6: G ray code generation

E h rlich [11] views algorithm s for g en eratin g p erm u ta tio n s, com binations, p artitions of n , a n d G ray codes as applications of th e generalized Jo h n so n -T ro tto r algorithm . T he J o h n so n -T ro tte r alg o rith m generates all p erm u ta tio n s in which a p erm u ta tio n differs from its predecessor by th e in terchange of tw o ad jacen t elem ents [27] [55]. From an algorithm ic p o in t of view, we will see t h a t our algorithm s for generating th e ideals of a forest poset are of th e sam e basic kind.

1.3

O rd erly A lg o rith m s

O rderly algorithm s were in tro d uced b y R ead in [41] and [42] in efforts to im prove naive grap h generation techniques such as th o se used, for exam ple, in Heap [25]. A typical clas­ sical alg o rith m for grap h generatio n m ay be illu stra te d as follows. C onsider the problem of m aking a list of graphs w ith q + 1 edges from a list of those w ith q edges. See F igure 1.7. In th e classical algorithm , we n o te th a t in step 2, isom orphic graphs are usually generated m any tim es, and in step 3, we have to search for G in th e en tire list L q+1; conducting an isom orphism test o f G again st all graphs already in th e list L q+i.

(18)

7

1. S ta rt witli a list L q o f all graphs with q edges. 2. Pick each graph of L q in tu rn and from it generate

candidates for th e list L q+\ by th e addition of a new edge ' ail possible ways.

3. As each candidate g ra p h G for L q+\ is produced

determ ine w hether L q+1 contains some grap h isom orphic to G. If it is th e case, reject G and continue

processing th e next candidate; if n ot, ad d G to L q+\.

F igure 1.7: G raph generation by a classical m eth o d

i

2

F igure 1.8: T h e code of a grap h

consider th e “code” of a graph, th e canonical graph. T h e canonical grap h rep resen ts th e isom orphism class to which it belongs. A ty p ical code for graphs is t h a t defined from th e adjacency m atrix as in Figure 1.8. T h e up p er trian g u lar elem ents o f an adjacency m a trix are read off by colum ns to give a bin ary string. T his strin g changes according to how th e vertices of th e grap h are num bered. A m ong all th e possible ways to n u m b er th e vertices, we choose th e one which makes th e strin g m axim al (e.g., lexically). T h e m axim al strin g is called th e code of th e graph. If a grap h is encoded in th is way, th e ta sk in ste p 3 of th e classical generation m ethod reduces to checking if th e code is alread y in

F u rth e r we define an ord er relation (th e ulisto rd e r” d enoted by “ -<” ) over th e elem ents of L q. If A -< B , we say th a t “A comes before B ” or “A precedes B ” o r “B comes after A ” .

(19)

1. S ta rt w ith L q of canonical graphs arranged in list order “ -<” . T h e list L q+i is initially em pty.

2. T ake each graph of L q in order an d apply on it w ith

th e au gm enting operation to get a sequence of candidates for L q+i 3. As each can d id ate G is produced, test if the candidate graph G is canonical, and if it comes after th e last grap h a t present in L q+i If it is so, add it to L q+1; otherw ise ignore it.

F igure 1.9: G rap h generation by an orderly algorithm

A typical exam ple of such an ordering is th e lexical ordering. If each graph is represented by its code defined as in th e above exam ple, th e lexical order of th e codes of L q is easily u n derstood. N ote th a t as opposed to th e classical algorithm s, o rd 'v ly algorithm s do not require a search of th e list L q+i in order to d eterm in e w heth er or no t a graph has already been generated.

T h ere are th re e things w ith which we have to be concerned w hen we design orderly algorithm s. F irst, we m ust define th e code for each isom orphism class over th e set of (labeled) graphs w ith th e p a ra m e te r q. Secondly, we m u st define the n a tu re of the aug­ m enting operatio n s. T hirdly, we m ust specify th e th ree orderings: (1) th e order in which th e codes of th e graphs a p p e a r in th e lists L q an d L q+1; (2) th e order in which the aug­ m en tin g process creates candidates for f/g+ i; (3) th e ord er used in th e definition of the code (th e ord er o f isom orphs).

Now, suppose we have an orderly algorithm creatin g L p+i from L p. C onsider a m apping / from a canonical g ra p h G in L p+j to a canonical grap h G ' in L p such th a t G ' is the first g ra p h in L p v'hich produced G. Such a m apping m ust satisfy th e following three conditions: (1) an y canonical g ra p h in L p+j can be produced by th e au gm enting operations from a t least one canonical grap h in L p; (2) th e m apping / is weakly m on o to n ic; th a t is, if X , Y £ Tg+i an d I x F , th en f ( X ) -< / ( F ) ; (3) th e ord er of au gm enting a canonical

(20)

A weak monotonic function f: L p+I —:» L p f(X>

' /

L p+1 r<x> r< y> ■“ “ “ • , J P V'SSs_ m ■ —■ ♦— L p+1 X Y r<X)=f(Y) . - £ , O' —1 O I-* P+-1 X Y

Figure 1.10: N ecessary and sufficient conditions for th e existence of orderly algorithm s

graph in L p conforms to th e order of graphs in th e list (S trictly speaking, graphs th a t are no t added to L pJri can b e generated in a n y order). T hese conditions a re illu stra te d in F igure 1.10. R ead [41] proved th a t these are not only sufficient b u t also necessary conditions for th e existence of orderly algorithm s. T h u s, designing an orderly algorithm is equivalent to finding such a weak m onotonic function.

Let us clarify th e com plexity of orderly algorithm s. L et L v den o te th e list of all non- isom orphic canonical graphs w ith a p a ra m e te r p. L et I ( p ) be th e tim e required to do an isom orphism test for two graphs w ith a p a ra m e te r p and A {p) th e tim e required to do a canonicity te st for a grap h w ith a p a ra m e te r p. A canonicity te st basically involves canonically labeling th e vertices of a grap h an d determ in in g w h e th e r o r n o t th e original labeling of the given graph is sam e as this canonical labeling. F in d in g a canonical labeling usually involves com paring th e labelings for a ll th e autom orphism s of a given graph. Let L'p be th e list of graphs augm ented from each canonical g ra p h of L p. (Hence, a n augm ented graph in is e ith e r canonical or non-canonical; therefore, precisely speaking L p is not

(21)

a list b u t a set. However, o u r m ain concern is th e cardinality of a set. T h u s, we use the te rm lis t instead of se t for convenience.) We denote th e cardinality of a set A' by |.\'|. In a classical generation scheme, each augm ented elem ent of L p is tested again st all the graphs in the c u rren t L p+1 being created. Therefore, th e to ta l tim e to com plete the list L p+1 is a t m ost \L p\\Lp+i \ I ( p + 1). O n th e o th er hand, th e to ta l tim e to create the list by an orderly algorithm is a t m ost \L “\A (p + 1). N oting th a t [Z,r,( is typically exponential or super-exponential, we realize th a t th e orderly algorithm shows a significant im provem ent over th e classical one. N ote th a t a t th e m om ent of w riting th is dissertation, it is nov known w hether or no t isom orphism te st can be done in polynom ial tim e in th e size of a graph. However, we can replace an isom orphism te s t by a procedure to find a canonic foim of a graph. I t is no t necessary t^ find a canonic form of a grap h in order to d eterm in e w hether a re p resen tatio n of a grap h is canonic, however, a procedure to find a canonic form of a grap h provides one m eans b y w hich a canonicity te s t can be perform ed.

O u r oraerly algorithm s described initially in this d issertatio n are slightly different from R e a d ’s original orderly algorithm w ith respect to th e order w ithin a list. In R oad’s algorithm , all th e graphs were ordered in some order w ithin a list. Suppose th a t wo do not concern ourselves w ith th e order of graphs in a list b u t all th e graphs in th e list have th e sam e p a ram eter, say, p. So, precisely speaking, th e te rm “list” is no t correct, b u t for convenience we use “list” instead of “set” . C an we g enerate a list L p so th a t the order of th e graphs in th e list does no t m atter? T h is is feasible since a canonicity test depends solely on th e graphs, b u t n o t on th e order of graphs in th e list L p. (If one needs an ordered list, we m ay so rt th e list la te r.) Such an orderly algorithm w ith o u t th e condition of linear order w ith in a list is called a weak-orderly algorithm . In th e final ch a p te r, we will describe a technique th a t can be used to transform w eak-orderly algorithm s to orderly algorithm s w ith th e p ro p e rty th a t all graphs in each generated list are ordered.

A n o th er difference betw een o u r orderly algorithm s an d R ead’s original orderly algo­ rith m is th e m eth o d of au g m en tatio n . A grap h can be classified by tw o n atu ra l p aram eters, nam ely, th e n u m b er of vertices p an d th e num ber of edges q. T h e original orderly algo­ rith m b y R ead [41] uses q as th e p a ra m e te r of th e list while p is fixed. In our orderly

(22)

11

algorithm s in this d issertation, we use th e n u m b er of vertices p as th e p a ra m e te r of the list and q varies as well. T h e num ber of edges varies since adding one v erte x can induce a different num ber of new edges (0 to p) incident w ith th e augm ented vertex.

Finally, we briefly describe th a t th e relationship am ong orderly algorithm s, the grap h coding problem , and the isom orphism problem . G raph generation ac tu a lly constructs graphs as well as counts them . T h u s, g ra p h generation requires effi :ient d a ta re p resen ta­ tion to avoid a m em bership te st, i.e., a te st to d eterm ine w hether or no t a given grap h has th e desired properties such as acyclicity, p la n a rity an d colorability (see C olburn and R ead[6]). F inding a good code for a specific graph family involves finding an efficient d a ta representation o f th e graph. T h u s, orderly algorithm s are also closely related to th e graph coding problem (see R ead and C olburn [45]). T h e grap h coding problem is, practically speaking, the problem of canonically labeling th e vertices of a given grap h by integers so th a t tw o graphs are isom orphic if and only if th ey have th e sam e labeling (th e code). Hence, if the grap h coding problem is solved efficiently, we can also solve th e isom orphism problem efficiently. A pplications of grap h coding can b e found in th e field of chem istry (see R ead [43], [44]).

1.4

P r e v io u s W ork an d A p p lic a tio n s

G en eratin g the ideals of a poset has several applications in O perations R esearch and O ptim ization. S teiner [53] tre a ts th e problem o f generatin g ideals as an in teg ral p a rt o f dynam ic program m ing algorithm s for precedence-constrained scheduling problem s, as­ sembly line balancing, p roject scheduling, and reachability in reliability netw orks. T h e problem of generating th e ideals o f a tre e poset lexically was first considered by R uskey [49]. T h e algorithm for ideal generation of [49] runs in lin ear average tim e. T h e algorithm o f S teiner [53] for generating all ideals of a n a rb itra ry poset runs in linear average tim e.

A lgorithm s for generating graphs axe useful in exploring certain conjectures in g ra p h theory a n d in o btaining census inform ation for graphical en u m eratio n problem s. L isting some families of chem ical com pounds can be done by generating graphs representing th e

(23)

chemical stru ctu re s. For exam ple, an alternant molecule is essentially represented by a bicolorcd grap h (see B alaban [1]). Chem ists are often interested in having som e com put­ erized sy stem for cataloging chem icals so th a t a given chem ical can be easily identified, m aking chem ical p a te n t searching, for exam ple, less tedious. T h e relationship between C hem istry and G ra p h T heory is exposited a t length in B alaban [1]. Bicolored graphs w ithout isolated vertices are also used to represent sim plical complexes which in tu rn represent some arch itectu re design problem s. O ne arch itectu ral application is concerned w ith th e m inim al re p resen ta tio n of p a tte rn s based on a re ctan g u lar grhl. Since a grid is a bicoiored graph, th ese p a tte rn s can be also represented b y bicolored graphs. See H arary et al. [22] for an application of enum eration techniques to arch itectu ra l design. D eter­ m ining th e value o f p erm anent of a m a trix can be done by an algorithm for counting all m axim um m atchings in a b ip a rtite graph corresponding to th e m a trix (see Nijenhuis and W ilf [38]). A technique for generatin g th e m axim um m atchings in a general grap h is used for analyzing some biom edical im ages (see T anim oto [54]). For developm ents in the field of graph generation, see R ead [42]. T h e problem of graph generation culm inated in 1981 w ith th e com pletion of th e ca ta lo g of all graphs w ith 10 vertices. F or an account of this cataloging, see C am eron e t al. [5].

T h e en u m eratio n by m eans of closed an aly tic form ulas of acyclic tran sitiv e digraphs (p a rtia lly ordered sets), finite topologies (tra n sitiv e d igraphs), and finite lattices are u n ­ solved problem s (see H arary a n d P alm er [23] an d also BirkhofT [3]). T h u s, in order to count th ese graphs w ith a given n um ber of vertices p, we m ust cu rren tly rely on gener­ ative m eth o d s. For acyclic tra n sitiv e digraphs and finite topologies, Evans, H arary, and Lynn [12], using a com puter, counted th e num bers of labeled cases on up to 7 vertices. For th e unlabeled case, graphs on up to 7 vertices have been generated and recorded in a book by Sloane [51]. C ulberson an d R aw lins [7] recently generated th e acyclic transitive digraphs u p to 11 vertices. L astly, K yuno [33] an d K yuno an d Ito [34] generated the finite lattices u p to 10 vertices.

In th e above described research, Evans e t al. and K yuno and Ito used an expensive isom orphism test to elim inate duplicates. B y using an orderly algorithm , we can avoid

(24)

13

the repeated use of an isom orphism test (see Read [41]).

A k - "d o red graph is represented by exactly th e sam e canonical form as can be used for acyclic digraphs. T h u s, we can obtain an orderly algorithm for generatin g A:—colored graphs from an orderly algorithm for generating acyclic digraphs. For labeled ^-colored graph enum eration, see Read[40] and for bicolored an d bicolorable graph enum eration, see Ilarary[17], [20].

1.5

O v erv iew

T h e plan of this dissertation is as follows. In C h ap ter 2, various definitions and notatio n which are used in la te r chapters are defined. In C h a p te r 3, th e algorithm for generating a binary reflected code by Ilitn e r E hrlich and R eingold is intro d u ced . T hen, th e exis­ tence? of a C ray code of lower ideals of a forest poset is given. Finally, th e alg o rith m for generating such lower ideals in a G ray code m anner is given and som e m ethods of lower ideals generated by the algorithm are also given. In C h a p te r 4, th e previous algorithm is im proved to an algorithm w ith theoretically o p tim al tim e com plexity. In C h a p te r 5, we describe orderly algorithm s for g enerating acyclic digraphs, acyclic tran sitiv e digraphs (posets). finite lattices, an d finite topologies. In C h a p te r 6, we give o rderly algorithm s for generating A:—colored graphs. We also p re sen t som e properties by w hich we m ay im prove the efficiency of orderly algorithm s in general. In th e last ch a p te r, we sum m arize our results and ■'escribe open problem s related to th e topics tre a te d in th is d issertatio n .

(25)

M a th e m a tic a l P r e lim in a r ie s

G rap h -th eo retical term s used in this dissertation m ay be found in Ila ra ry [20], except th a t in this d issertatio n , p o in ts are called vertices and lines are called edges and similarly, p oset-theoretical term s m ay be found in S tanley [52]. F or th e convenience of the reader, however, some o f th e ce n tral term s are recalled in th is ch a p te r. We consider a set of elem ents P an d a binary relation < defined on P . In this d issertatio n , the nu m b er of elem ents in P is always finite. By an abuse of n o tatio n , we denote this as P = (P , < ). We say t h a t x and y a re comparable if eith er x < y or y < x \ otherw ise, they a re incomparable. We w rite a: < y if x < y b u t x ^ y. T his P can be represented as a grap h as follows. Let each elem ent x in P be represented by a vertex. Let tw o vertices x and y be connected by a n arc from y to x if th e corresponding tw o elem ents x an d y are such th a t x < y. T hen, th e g ra p h constructed in such a way is called a digraph, denoted also by P , for convenience.

A d igraph P is called a transitive digraph if P satisfies th e condition: for x an d y in -P) x < U and y < z im ply x < z (tra n s it vity). Refer to F igure 2.1 for an exam ple of a tran sitiv e digraph.

A sequence o f d istinct elem ents in P , C = x x < x2 < . . . < x n is called a chain or directed path in th e corresponding graph if any consecutive two elem ents of C are com parable w ith respect to th e binary relation in P . T h e length o f the chain C is denoted by 1(C) = | C | - 1 . If x i and x n are equal in th e chain, th e chain is called a directed cycle.

(26)

15

A digraph P which has 110 directed cycles is called an acyclic digraph.

A source is a vertex w ith no incom ing arcs. If a: is a vertex of a digraph P having no directed cycles, we define th e height h( x ) as follows. h( x ) = s u p { l{ C ) : C ch a in £ C(x) }, where C(x) = { y £ P : 3 ch a in f r o m y to a:}. In p artic u la r, if a: is a source, h( x ) = 0 . Similarly, h ( P) — su p { h (x ) : x £ P ] is th e height of P . If th e underlying digraph is clear, wo sim ply w rite h (w ith o u t a param eter) instead of h ( P) . A layer is a set of elem ents in P which have th e sam e height. See F igure 2.2.

A digraph P is called a partially ordered set (poset) if th e b in ary relatio n satisfies the following tw o ad d itio n al conditions as well as tran sitiv ity : ( F a; < x for all x £ P (refiexivity), and (2) x < y an d y < x im ply x — y (an tisy m m etry ). A graph representing a p artially ordered set is called an acyclic transitive digraph. A n elem ent a: of a poset P is m c n m a l (m inim al) if x < y (x > y ) implies x — y for all y £ P \ x is greatest (least) if y < (y > x) for all y £ P .

We generally denote a poset by V , an d its underlying graph by P . We den o te th e set of elem ents in V by S ( V ) an d relation 1 h a t defines V by R ( V ) C S ( V ) X S ( V ) . If x, y G V , then we say y c o v rs x if x < y and no elem ent z 6 P satisfies x < z < y. We also say th a t .r is a child of •/ and y is a p a r e n t of a: if x < y. A n ideal I of a poset V is a subset of the elem ents of V such th a t x £ I an d y < x implies th a t y £ I .

An antichain, A, is a subset of th e elem ents of V in which every tw o elem ents are

(27)

2 4 6

5 3

Figure 2.2: A n exam ple of acyclic digraph w hose vertices are ordered by distance from sources

incom parable; t h a t is, if a:, y € A w ith x ^ y, th e n neither x < y nor y > x holds. Observe th a t th e set of m axim al elem ents M in an ideal I forms a n antichain and M fixes I in the sense t h a t I — {a:|3m £ M , x < m ). T h u s, th e re is a one-to-one correspondence between th e ideals and th e antichains.

T h e poset th a t is an an tich ain o f n elem ents is denoted A n . For tw o sets A and B, the H am m ing d istan ce betw een th e tw o sets A an d B is th e n u m b er of elem ents in which they differ, th a t is, J { A , B) — |(A - B) U (B — A )|.

A p o set can b e represented b y a Ilasse diagram in w hich d istin c t elem ents are repre­ sented b y d istin ct points, in which x is placed above y w henever x > y, and x and y a r e joined b y an arc from x to y w henever x covers y. A ny finite poset is determ ined up to isom orphism by its diagram .

If th e H asse diagram of a poset V is a tre e rooted a t a unique m inim al elem ent, we sim ply say th a t th e poset is called a tree poset and th e Ilasse diagram is term ed a tree. If th e H asse diag ram of a po set is a disjoint union of trees, we term th e poset a forest poset. W e m ay tr e a t this tree poset as an ord ered tree w ith th e m inim al elem ent being the ro o t. In general, there are m any ordered trees corresponding to a given poset. We will pick up one of th em as a rep resen tativ e o f th e poset. If a poset is a tree poset, a tree is an o rie n te d ordered tree, w here th e direction of arcs a re oriented tow ards th e root, the m inim al elem ent. By ordered tree we m ean its subtrees a re ordered. An ordered forest is sim ilarly defined. Nodes in an ordered forest a re num bered in preorder.

(28)

17

C hildren of a com m on p aren t are called siblings. Rooted-subtrees are subtrees whose m inim al elem ent is th e ro o t of a tree poset. T hen, we can easily see th a t th ere exists a one-to-one correspondence betw een th e set of lower ideals of a tre e poset T and th e set 01 rooted-subtrees. By th e definition of an ideal, th e em p ty su b tree is also an ideal of a tree. Each ideal of a tree is represented by a codeword of a b it-strin g w here “0” m eans the corresponding elem ent is n o t in th e ideal an d “1” m eans th e corresponding elem ent is in th e ideal. In this paper, su b tree m eans rooted -su b tree unless otherw ise stated .

A fo rest poset is one whose Hasse diagram is an ordered forest. T h e ro o ts of th e trees of th e forest are th e m inim al elem ents of th e poset. B y x -< y or y y x we m ean th a t the elem ent x is th e predecessor of y or y is th e successor o f x in th e p reo rd e rin g of th e elem ents in a forest poset T .

In R uskey [49] th e ideals of a t ’-ee poset are called r-subtrees. T h e se t of ideals of a poset V , ordered by set inclusion, form a d istrib u tiv e la ttic e J { V ) . It is well know n t h a t for every finite d is t”ib u tiv e la ttic e L, th ere is a unique poset V for w hich J { V ) is isom orphic to L. For m ore inform ation an d th e definition on a d istrib u te d lattic e, see S tan ley [52J. In a slight abuse of no tatio n , we also use J ( P ) to denote th e H asse diagram o f th e la ttic e of ideals of 'P. In this con tex t we refer to J( f P) as the ideal graph of P . W e a re in terested in finding H am ilton cycles an d p a th s in th e underlying u n d irected graph of H asse diagram s of d istrib u tiv e lattices (such a cycle or p a th yields a G ray code of th e ideals, th e o b ject of our algorithm s). For m ore inform ation on posets an d ideals, see S tanley [52].

N ote th a t J ( P ) is connected and b ip a rtite . I t is connected since every d istrib u tiv e lattic e lias a m axim um and a m inim um elem ent. T h ere is a b ip a rtitio n o f th e vertices of J ( ’P) in to tw o sets, E ven{V ) and 0 d d ( V ), depending on w h e th e r th e ideal represented by a vertex has an even or odd n um ber of elem ents. T h e p a rity difference d ( V ) of a poset V is defined to be th e difference \E ven(V )\ — 10 dd{P)\.

T h ere are two sta n d a rd ways of com bining posets to get a new poset. T h e direct sum of tw o disjoint posets V and Q is th e poset V + Q on th e union S ( V ) U £ ( 2 ) such th a t x < y in V + Q if an d only if eith er x , y £ V an d x < y in V , or x , y € Q and x < y in Q. T h e ordinal sum of tw o disjoint posets V an d Q is th e poset V ® Q on th e union

(29)

S (V) U S ( Q ) such th a t a: < y in V 0 Q if x , y £ V a n d x < y in V , or x , y £ Q and x < y in Q, or if x £ V and y € Q. N ote th a t a tree p o set can be built up by applying the operations of direct sum of tw o forest posets and th e ordinal sum of a forest poset w ith a single elem ent.

A g ra p h G = (V (G ), E ( G )) consists of a set of vertices V { G ) and a subset of unordered pairs of vertices called edges E ( G ) C V ( G ) X V (g). T h e product of th e graphs G and H is the g ra p h G x H w ith vertex set Vr(G ) X V ( I I ) , in w hich [v, w] is ad jac en t to [?>', «>'] if and only if v — v' and [w, w '] £ E { I I ) or w = w ' and [u, v'] £ E ( G ) . We can easily see th a t

J(7>! + Vi )J (V i ) x J {V2) (‘2.1)

where = denotes g ra p h isom orphism .

W e a re in terested in efficient algorithm s for generating com binatorial objects. Suppose th a t th e objects a re represented b y sequences of n elem ents an d th a t th e to ta l num ber of objects is N . An alg o rith m for g enerating those o b jects is said to ru n in constant average time if th e to tal a m o u n t of c o m p u tatio n (excluding o u tp u t) is 0 ( N ) . If the to ta l am ount of com p u tatio n is 0 ( n N ) , th e n th e algorithm is said to ru n in linear average time.

A c o n sta n t average tim e alg o rith m is said to be loopless (o r c o n sta n t w orst-case tim e) if (a) th e am o u n t o f co m p u tatio n used in going from one o bject to th e next is 0 ( 1); (b) the am o u n t of co m p u tatio n needed to produce th e first o b ject is 0 ( n ); an d (c) th e am ount of co m p u tatio n needed to decide w h eth er an o bject is th e last one is 0 ( 1). Up to a co n stan t factor, no algorithm can be fa ste r th a n a loopless algorithm . Sim ilarly, a lin ear average tim e alg o rith m is called linear worst-case tim e if (a) and (c) above can be done in 0 (n ).

A lattice L = (L, V, A) is a poset L such th a t for every two elem ents x , y in L, the poset { z £ L : z > x , z > y } has a least elem ent x V y € L, th e jo in of x an d y, and the poset { z £ L : z < x , z < y } has a g re atest elem ent x A y € L , th e meet of x and y. We call th is lattic e p ro p e rty the unique bound condition. If only eith er a g re atest or a least elem ent is defined for any tw o elem ents x and y, th e lattic e is called a semilattice. For sim plicity, the H asse diagram of a la ttic e is also called a lattice.

(30)

19

d c

Figure 2.3: L4: F our elem ents n o t satisfying the unique hound condition

PROPOSITION 2 . 1 I f a poset P is a lattice, then P does no t contain the poset L 4 o f figure

2.3 as a subposet.

If th ere is such a set of four elem ents in P , w e say th a t th e four elem ents violate the unique bound condition.

A digraph is strongly connected, or strong, if an y two vertices are m u tu a lly reachable by a directed p a th . A strong component of a d ig rap h G is a m axim al stro n g subgraph. Let S\ , S 2, ■ ■ ■, S m be the stro n g com ponents o f G. T h e condensation G* o f a d ig rap h G

is a d ig rap h th a t has the stro n g com ponents of G as its vertices, w ith an arc from S i to

Sj w henever th ere is a t least one arc in G from a vertex of S{ to a v e rte x in Sj. T h e condensation G* of any dig rap h G has no cycles, and hence is an acyclic digraph. Tw o vertices u and v of th e d igraph G are similar if th ere is som e au to m o rp h ism a of G, for which a ( u ) = v. Tw o edges x \ = (u i,U i) an d x2 = ( u2, v 2) are similar if th ere is an autom orphism a of G such th a t a ( ( u i , u i ) ) = ( u 2, v2). A d ig ra p h is sym m etric if every p air of vertices is sim ilar an d every p air of edges is sim ilar.

We s ta te tw o lem m as w ith o u t proofs. For th e proofs, see H a ra ry [12](page 200).

Le m m a 2 . 1 Every strong com ponent o f a transitive digraph is complete and symm etric.

LEMMA 2 . 2 The condensation o f a transitive digraph with m strong components is itself an acyclic transitive digraph on m vertices.

(31)

r sucli th a t u> is th e r t h m em ber of th e family. T he lexical order of two vectors v and w is defined as follows. If v = (i>i, «2, • • •»v n) an d w = (u q , w2, - . . , w rn), th e n v is lexically larg e r th a n w (denoted by eith er v X- w or w -< v) if an d only if th ere is som e k < m , n such th a t V{ = Wi for all i < k , and vk > Wk for som e k < m , n , or n > m an d for I < i < m , V{ = If v could be equal to w, we w rite v y w or w < v.

F or a given vector of size n , v = (e i, e2, . . . , c n), a prefix v ' is defined to b e th e subvector com posed o f th e leading i elem ents of n; th a t is, v ' = ( e i, e2, . . . , e;), 1 < i < n.

A perm utation m a trix S is a square m a trix which has precisely one “1” in each row and precisely one “ 1” in each colum n. T h e p erm u ta tio n m a trix S is obtained from the identity m a trix by in terch an g in g th e fcth row w ith th e r t h row such th a t k < r and c rk ^ 0. Let M b e a square m atrix . T hen, M ' = S X M , where “ x ” is the usual m atrix m ultiplication, is th e square m a trix ob tain ed b y interchanging the fcth row and th e r t h row in th e m atrix M an d M " = M X S is th e square m a trix o btained by interchanging th e fcth column an d th e r t h colum n in th e m a trix M . If M is an adjacency m a trix for a graph G, then M ' = S X M x S is th e adjacency m a trix for th e grap h G obtained b y interchanging th e labelings of th e vertices k an d r. T h e m ultiplication of tw o p erm u ta tio n m atrices S ' = S i X S2 is obviously also som e p erm u ta tio n m atrix .

A A’-colored g ra p h is a g ra p h G = ( X i , X2, . . . , X k , V , E ) w here Xi , i = 1 , . . . , k are m u tu a lly disjoint subsets of th e vertices V , w ith u£_x X,- = V a n d E is th e set of edges,

w hich is a su b set of unordered pairs of vertices (a;,-, Xj ), Xi £ X i an d Xj £ X j , 1 < i < j < k.

W e consider in this p a p e r only th e /s-colored graphs for which each of th e X i , i = l , . . . , k is n o t em pty, i.e., |X i| = m,- > 0 .

(32)

C h a p te r 3

F o rest P o s e t id ea ls

3.1

In tr o d u c tio n

A m ong all th e G ray codes th e one m ost widely know is called th e B in ary R eflected G ray C ode (B R G C ). A lgorithm E due to E hrlich [11] for generating th e B R G C is described in Figure 3.1. T his algorithm runs in 0 ( n ) tim e from one codew ord to th e n e x t. T h e algo­ rith m can be viewed as analogous to th e well know n Jo h n so n -T ro tte r algorithm [27][55] for generatin g p erm u ta tio n s. In th e Jo h n so n -T ro tter algorithm , each elem ent has an asso­ ciated priority, an d a sta tu s. If th e s ta tu s of an elem ent is movable, it is m oved(sw apped w ith th e ad jacen t elem ent), otherw ise, th e elem ent of th e n ex t highest p rio rity is m oved. Once an elem ent of some p rio rity is moved, all th e elem ents w ith higher p riorities becom e movable. T h e process continues u n til all th e elem ents are n o t m ovable.

In th e case of o u r algorithm s, th e p riority of th e elem ents of a forest poset is defined according to th e preorder of th e elem ents in th e forest p o set (th e ro o t elem ent has th e highest prio rity ). All th e elem ents are considered according to th is p rio rity as in th e Jo h n so n -T ro tter algorithm . In add itio n , all th e elem ents have predecessor or successor relationships in th e poset. Unlike th e Jo h n so n -T ro tter algorithm , only th e elem ents in the c u rre n t ideal or having a predecessor in th e c u rre n t ideal are considered. M oreover, no elem ents having a successor in th e ideai can be an ca n d id a te to b e rem oved from th e c u rren t ideal.

(33)

Algo- ith m E lias been im proved by B itner, Elirlicli and Reingold to th e one which runs in 0 ( 1 ) tim e from one codew ord to th e next. We refer to th eir algorithm as Algorithm B ER.

We ad o p t a different appro ach to im prove A lgorithm E. A lgorithm B, our version of A lgorithm B E R (to be explained in C h ap ter 4), is used as a subprocedure in th e algorithm for g en eratin g ideals of a forest poset which is th e m ain result of th e first p art of this dissertation.

3.2

T h e E h rlich an d B E R A lg o rith m s

Now, w e in tro d u ce A lgorithm E by E hrlich [11]. In connection w ith our A lgorithm P for generatin g forest ideals, we describe A lgorithm E in term s of poset elem ents. Algorithm E works on n u n re la ted p o set elem ents (i.e., an antichain) A n . T h e algorithm lists all the possible subsets S of A n . W j assum e th e elem ents are labeled in increasing order from one to n and arran g ed accordingly w ith th e sm allest on yo u r left. T h e sm aller th e label is, the higher th e priority.

W e consider t h a t each elem ent of A n can ta k e eith er f r e e s ta tu s or s tu c k statu s. If th e s ta tu s of th e elem ent is free, th e elem ent m ay b e eith er rem oved from th e current subset S (th e elem ent is deletable) or added to S (th e elem ent is a u g m e n ta b le ); otherw ise, th e s ta tu s of the elem ent is stuck an d it can b e n eith er rem oved from S nor added to S . T he set A n is changeable if th ere exists an elem ent w hich is e ith e r d eletable or augm entable.

Initially, all th e elem ents are f r e e . T h e algorithm runs as long as th ere exists a free elem ent in S (ste p (4)). W e choose th e leftm ost free elem ent v from S (step (5)). T hen, all th e elem ents to th e left of v becom e free an d v itself becom es stuck (steps (6 ) and (7)). D epending on w h e th e r or n o t v is in S , we add v to or delete v from S (ste p (8)). After th e u p d a te d S is o u tp u t (step (9)), we re tu rn to step (4).

(34)

23

( 1) forall v € S d o status(v) <— free; (2) S <— 0;

(3) O utput(A ');

(•1) w h ile S is changeable d o b e g in

(5) v <— min{v £ «? | v is changeable};

(fi) fo ra ll w < v d o status(w ) <— free ;

(7) status(v) <— siucfe; (^) i f n € 5 th e n S <— S {n} e ls e S <— 5 U {«}; (9) O utput(A '); (10) end; F igure 3.1: A lgorithm E

3.3

T h e E x iste n c e o f a G ray C o d e o f L ow er Id ea ls o f a

F orest P o s e t

A pi oof of th e existence of a G ray code of lower ideals of a forest poset is given by induction on th e n u m b er of elem ents in th e poset. If a G ray code has th e p ro p e rty th a t th e first codeword and th e la st codeword difFer by a single elem ent, it is called a cyclic Gray code. N ecessary an d sufficient conditions for a G ray code of lower ideals of a forest poset to be cyclic are also given below.

F irst, we give tw o easy lem m as. We show th a t th e re is a H am iltonian p a th in J ( V ) if V is a forest poset. T his will follow as a consequence of m ore general results a b o u t th e ordinal and direct sum s of posets. A necessary condition for th e existence of a H am iltonian p a th in J ( V ) is th a t th e p a rity difference \d(V)\ < 1. L et us first d eterm ine d ( V ) if V is a forest poset.

L et i[V) denote th e nu m b er of elem ents in J ( V ) (th e n u m b er of ideals o f V ) . It is easy to show th a t i ( P + Q ) = i( V ) X i(Q ) and t h a t i(V ® Q) = - 1 + i( V ) + i(Q). Similarly, we have

(35)

d{V + Q) = d(V )d{Q )

d{V © Q) = • —1 + d ( V ) + d(Q ) if |V\ is even + 1 + d { V ) - d ( Q ) if |^>j is odd

F or forests we apply (3.2) w ith V = A \ . Since d ( A \ ) = 0, th e p a rity difference fm forests is 0 o r 1. However, th a t d ( V ) = 0 is no t a sufficient condition for J ( V ) to have a H am iltonian p~th. Such an exam ple is illu strated in F igure 3.2.

LEMMA 3 . 1 L et V and Q be non-em pty posets both o f whose ideal graphs hare Hamiltonian

i f \ J { V ) \ (or \ J { Q ) \) is even then J ( P + Q ) has a Hamiltonian cycle.

PROOF: Let H be a H am ilto n ian p a th in J { V ) and I I ' be a H am iltonian p ath in J (Q ). T h e n H x H ' is a sp an n in g su b g ra p h of J ( V ) x J ( Q ) . Hence, by (2 .1) it is again isom orphic to a sp anning su b g rap h of J ( V + Q ). Since I I and I I ' are p ath s, I I X I I ' is an | / / | by \II'\ grid graph. T h e ideal 0 o f J ( V + Q) corresponds to th e corner vertex (0 ,0 ) of II x I I '. It is easy to c o n stru c t a H am iltonian p a th in a grid grap h , sta rtin g a t a corner. Furtherm ore, unless b o th \H\ and \H'\ are o d d , a H am iltonian cycle can be found easily in II x II '. □ paths starting at 0. T h en J ( V + Q) has a Hamiltonian path starting at 0. Furthermore,

J(P)

(36)

25

Le m m a 3 . 2 Let V be a poset f o r which J { V ) has a Hamiltonian path starting at 0 and ending at S ( V ) , and let Q be a poset fo r which J ( Q ) has a Hamiltonian path starting at 0. T hen there is a Ham iltonian path in J { V © Q) starting at 0.

PROOF: Lot a i , a 2, .. .,a iv be a H am iltonian p a th in J ( V ) where a i = 0 an d ajv = S ( V ) . Lot b \ , 62, .. . , 6a / he a H am iltonian p a th in J ( Q ) where 6/ = 0. T h en th e p a th

a i , a 2, . . . ,ayv U b i , a ^ U b2, . . . ,a /v U 6a/

is a H am iltonian p a th in J ( V © Q) sta rtin g a t 0.

N o te th a t the condition o f Lem m a 3.2 th a t th e H am iltonian p a th in J { V ) ends a t SlfP) cannot bo relaxed since S ( V ) is a cut v ertex of J ( V @ Q) (if V and Q are b o th non-em pty).

As a consequence of L em m as 3.1 an d 3.2 we have th e following theorem . T h e p ro o f is im m ediate by in duction on th e num ber o f nodes in th e forest, n o tin g th a t an y forest poset T can be constructed by re p eated applications o f eith er h i + T2 or T\ 0 T2 where Tj for .7 = 1 ,2 are disjoint subtrees o f T such t h a t i ( T j ) < i(!F) for j = 1,2.

Th e o r e m 3 . 1 I f V is a forest poset, then there is a H amiltonian path in J ( V ) .

We can also characterize tho se forests posets whose ideal graphs h ave H am iltonian cycles.

Th e o r e m 3 . 2 Let IF be a forest poset consisting o f trees T \ , T 2, • • •, T*. There is a Hamil­

tonian cycle in J(IF) i f and only i f k > 2 and there is at least one tree T{ for which | J(T,-)| is even.

P r o o f : If k = 1, th e n 0 is a p e n d a n t v e rte x in J(IF). If all ] J(T,-)| are o d d th en i ( T ) is odd, an d since J(IF) is b ip a rtite it cannot have a H am iltonian cycle. O n th e o th er han d , if k > 2 and there is a t least one tree T t- for w hich |7 (2 i)| is even, th en by Lem m a 3.1

(37)

3.4

A lg o r ith m P

A lgorithm P generates all lower ideals of a forest poset w ithout rep etitio n . It determ ines successive ideals by traversing th e previous ideal in effect in preorder. T h e tran sitio n from one ideal to th e n e x t takes 0 (n) tim e in th e w orst case, where n is th e num ber of elem ents of P . E xperim entally, however, th e algorithm has been found to exhibit on th e average co n stan t tran sitio n tim e from one ideal to th e next. We offer th e conjecture (see C h ap ter 7) t h a t A lgorithm P has co n stan t average tra n sitio n tim e, b u t th e problem ap p ears to be difficult.

T h eorem 3.1 is constructive. N ote, however, th a t the algorithm corresponding to die proof of T h eo rem 3.1 m ay yield different H am iltonian p ath s in J ( P ) for a given forest poset V depending on how V is decom posed in to sm aller tree posets. In this section we will describe a n algorithm th a t finds such a p a rtic u la r H am iltonian p a th system atically. T he m ain idea is to use a decom position based on a depth-first search. In C h a p te r 1 we will show how to im prove this algorithm so th a t it is loopless.

In C hap ters 3 an d 4 we deal w ith a fixed forest poset T w ith n elem ents. T h e elem ents of a forest poset are referred to as nodes (W e will reserve the term v e rtic e s for discussion of th e ideal g ra p h ). T h e p a re n t of a node v is denoted by par(v). We extend th e notions of s t a t u s , and changeable defined on an elem ent in an antichain to those defined on an elem ent of a poset. E ach node v has a sta tu s , status(v), which takes on one of tw o values, free o r stuck.

DEFINITION: L et F b e a rooted subforest o f a forest poset T , and v a node for which status(v) = free.

• If v F , th e n v is augmentable if v is a ro o t o r par(v) is in F.

• If v E F th e n , v is deletable if none of th e children of v is in F an d the s ta tu s of each child is stu c k .

A node th a t is aug m en tab le or deletable is said to be changeable. If there is a change­ able node in F , th e n F is changeable; if u is n o t in F , we say th a t v is null w ith respect

Referenties

GERELATEERDE DOCUMENTEN

Het Sociaal Overleg Sittard-Geleen is een Stichting die staat voor collectieve belangenbehartiging van mensen, die door omstandigheden gedwongen een beroep moeten doen op een

Contrastingly, collectivist cultures tend value implicit CSR, which is “the cooperation’ role within the wider formal and informal institutions for society’s interests and

Furthermore, it is equal to the Laplacian pseudoinverse when calculated for undirected graphs and in Section 8.2 it is shown that the square root of the e ective resistance is a

Wie de radicale muziek van, bijvoorbeeld, LOOS kent, zal niet verbaasd zijn dat Van Bergen en Koek gefasci­.. neerd zijn

In deze nieuwe droom gaan wij voor rust; rust in de zaal en rust op jouw bord.. Om langer aan je zij te

te krijgen. Ik hoop de komende tijd alle bewoners en medewer- kers te leren kennen en ver- heug me op een goede samen- werking met iedereen. Ik ga er zeker mijn best voor doen

In deze uitgave verneemt u ook meer over het brede aanbod aan wandelingen, fiets- routes, activiteiten en evenementen aangeboden door Toerisme Oostende. Musea,

Zelfs maanden daarna sprongen Milan bij plotselinge bewegingen nog de tranen in de ogen, en nu nog werd hij soms wakker met een sloopkogel achter zijn voorschedel, alleen maar