Random Generation and Enumeration of Proper Interval Graphs

26
Random Generation and Enumeration of Proper Interval Graphs Toshiki Saitoh(JAIST) Katsuhisa Yamanaka(Univ. Electro- Communi.) Masashi Kiyomi(JAIST) Ryuhei Uehara(JAIST)

description

Random Generation and Enumeration of Proper Interval Graphs. Toshiki Saitoh(JAIST) Katsuhisa Yamanaka(Univ. Electro-Communi.) Masashi Kiyomi(JAIST) Ryuhei Uehara(JAIST). Introduction. Processing of huge amounts of data Data mining, bioinformatics, etc The data have a certain structure - PowerPoint PPT Presentation

Transcript of Random Generation and Enumeration of Proper Interval Graphs

Page 1: Random Generation and Enumeration of Proper Interval Graphs

Random Generation and Enumeration of Proper Interval Graphs

Toshiki Saitoh(JAIST)

Katsuhisa Yamanaka(Univ. Electro-Communi.)

Masashi Kiyomi(JAIST)

Ryuhei Uehara(JAIST)

Page 2: Random Generation and Enumeration of Proper Interval Graphs

Introduction

Processing of huge amounts of data Data mining, bioinformatics, etc The data have a certain structure

Interval graphs in bioinformatics

Our problems (P.I.G. : proper interval graphs) Random generation of P.I.G. Enumeration of P.I.G.

P.I.G.: subclass of interval graphs P.I.G. strings of parentheses⇒

Generating

Enumerating

Page 3: Random Generation and Enumeration of Proper Interval Graphs

Known Algorithms Generation of a string of parentheses

D.B.Arnold and M.R.Sleep, 1980 can’t generate P.I.G. uniformly at random

Enumeration of strings of parentheses D.E.Knuth, 2005

can’t enumerate every P.I.G. in O(1) time

Not one-to-one correspondence

constant size of differences in string

⇔ large size of differences in P.I.G.

Page 4: Random Generation and Enumeration of Proper Interval Graphs

Our Algorithms Random Generation

Input: Natural number n Output: Connected P. I. G. of n vertices

Uniformly at random Using a counting algorithm O(n+m) time (m: #edges)

Enumeration Input: Natural number n Output: All the connected P. I. G. of n vertices

Without duplication Based on reverse search algorithm O(1) time/graph

Page 5: Random Generation and Enumeration of Proper Interval Graphs

Interval Graphs

Have interval representations

Page 6: Random Generation and Enumeration of Proper Interval Graphs

Every interval has the same length

Proper Interval Graphs

Have unit interval representations

String representations

Page 7: Random Generation and Enumeration of Proper Interval Graphs

Definition String Representation

Encodes a unit interval representation by a string Sweep the unit interval representation from left to right

Left endpoint → “(” : left parenthesis Right endpoint → “)” : right parenthesis

( ( ( ) ) ( ( ) ) )

Unit Interval Representation String Representation

Right endpoints appear in order of their left endpoint appearances

( ( ( ) ) ( ( ) ) )

Page 8: Random Generation and Enumeration of Proper Interval Graphs

String Representation

( ( ( ) ) ( ( ) ) )

0 1 2 3 2 1 2 3 2 1 0

0

+1 +1 +1 -1 -1 +1 +1 -1 -1 -1

Property of string rep. of P. I. G. of n vertices Number of parentheses: 2n

Number of “(”: n Number of “)”: n Non-negative

Each left parenthesis exists in the left side of its right parenthesis

Each number is non-negative

Height

Height = # “(” - # “)”

Page 9: Random Generation and Enumeration of Proper Interval Graphs

String Representation

( ( ) ) ) (

0

Property of string rep. of P. I. G. of n vertices Number of parentheses: 2n

Number of “(”: n      Number of “)”: n Non-negative

Each left parenthesis exists in the left side of its right parenthesis

Negative height

Not correspond to any interval rep..

Page 10: Random Generation and Enumeration of Proper Interval Graphs

String Representation

( ( ) ) ( )

Unit Interval Rep. Graph Rep.0

Property of string rep. of P. I. G. of n vertices Number of parentheses: 2n

Number of “(”: n      Number of “)”: n Non-negative

Each left parenthesis exists in the left side of its right parenthesis

There are more than 2 places whose heights are 0.Each component corresponds to each area that is bounded by 2 places whose heights are 0.

Page 11: Random Generation and Enumeration of Proper Interval Graphs

String Representation

Observation 1 String rep. of connected P. I. G.

Have exactly 2 places whose heights are 0. The left end and the right end

( ( ( ) ) ) ( ( ) ) )

00

( )The string excepted both ends parentheses is non-negative

Page 12: Random Generation and Enumeration of Proper Interval Graphs

String Representation

Lemma 1. (X. Dell, P. Hell, J. Huang, 1996) A connected P. I. G. has only one or two string rep.

( ( ) ( ( ) ( ) ) )

Proper Interval Graph Unit Interval Rep. String Rep.

( ( ) ( ( ) ( ) ) )

This graph has only two string representations.

different strings

Page 13: Random Generation and Enumeration of Proper Interval Graphs

String Representation

String Rep.

( ( ) ( ( ) ) ( ) )

Proper Interval Graph Unit Interval Rep.

( ( ) ( ( ) ) ( ) )

reversible

This graph has only one string representation.

Lemma 1. (X. Dell, P. Hell, J. Huang, 1996) A connected P. I. G. has only one or two string rep.

Page 14: Random Generation and Enumeration of Proper Interval Graphs

Random Generation Algorithm of Proper Interval Graphs

Page 15: Random Generation and Enumeration of Proper Interval Graphs

Random Generation Algorithm

Generate a string rep. uniformly at random Using a counting algorithm

(Generalized) Catalan number

( ( ( ( ) ) ( ) ( ) ) )

'

'2

1'

1)'(

n

n

nnC

00

String rep. : Path on the area

Page 16: Random Generation and Enumeration of Proper Interval Graphs

Adjust the Generation Probability

String rep.Non-reversible strings

Reversible strings

( ( ) ( ( ) ( ) ) )

( ( ( ) ( ) ) ( ) )

( ( ) ( ( ) ) ( ) )…

……

……

A generation probability of a graph corresponding to non-reversible strings is higher than that of reversible one

Decrease the generation probability

Not easy

Page 17: Random Generation and Enumeration of Proper Interval Graphs

Adjust the Generation Probability

String rep.Non-reversible strings

Reversible strings

( ( ) ( ( ) ( ) ) )

( ( ( ) ( ) ) ( ) )

( ( ) ( ( ) ) ( ) )

( ( ) ( ( ) ) ( ) )

Sn: # non-reversible strings

Rn: # reversible strings

Case 1

nn

nn

RS

RS

2Prob

Case 2

nn

n

RS

R

2Prob

: Uniformly at random

……

……

……

2/

)(

n

nR

nCRS

n

nn

Page 18: Random Generation and Enumeration of Proper Interval Graphs

Case 1

Generation of a string uniformly at random Generate parentheses from left

Select “(” or “)”

Time complexity•String Rep. : O(n)•Graph Rep. :O(n+m)

( ( ( )

n

in

in

iinC

2

2),(

)1(2

)2(

hk

hkh

qp

p

)1(2

)2)((

hk

hhk

qp

q

“(” :

“)” :q = C(k, hr)

p = C(k, hl)

) ( ( ) ( ) ) )

k: # remaining parentheses

h: Height

Generalized Catalan Number

m: # edges

Page 19: Random Generation and Enumeration of Proper Interval Graphs

Case 2 Generation of reversible string uniformly at random

Generate a half of the string

1. Choose the height at the center

2. Generate parentheses from the left end Select “(” or “)”

2/)(

1

1

1

hn

n

n

h

(

k: # remaining parentheses

h: Height

(p: complicated!

n

in

in

iinC

2

2),(

Generalized Catalan Number

Symmetric

Page 20: Random Generation and Enumeration of Proper Interval Graphs

Case 2 Generation of reversible string uniformly at random

Generate a half of the string from the center to the right end

1. Choose the height at the center

2. Generate parentheses from the center Select “(” or “)”

2/)(

1

1

1

hn

n

n

h

()

q = C(k, hr)

p = C(k, hl)

n

in

in

iinC

2

2),(

) ) ) )) ( ) ) ) )

k: # remaining parentheses

h: Height

Time complexity•String Rep. : O(n)•Graph Rep. :O(n+m)

)1(2

)2(

hk

hkh

qp

p

)1(2

)2)((

hk

hhk

qp

q

“(” :

“)” :

Generalized Catalan Number

m: # edges

Page 21: Random Generation and Enumeration of Proper Interval Graphs

Enumeration Algorithm of Proper Interval Graphs

Page 22: Random Generation and Enumeration of Proper Interval Graphs

Simple Enumeration Algorithm

Huge memory Low speed

remove

1 edge

Not P.I.G.

Has the obtained graph outputted?

Page 23: Random Generation and Enumeration of Proper Interval Graphs

Reverse Search Algorithmremove

1 edge

Our algorithm Canonical string O(1) time/graph O(n) space

( ( ( ( ( ) ) ) ) ) ( ( ( ( ) ( ) ) ) ) ( ( ( ( ) ) ( ) ) )

( ( ( ) ( ) ( ) ) ) ( ( ( ( ) ) ) ( ) )

( ( ( ) ) ( ( ) ) ) ( ( ( ) ( ) ) ( ) )

( ( ( ) ) ( ) ( ) )

( ( ) ( ) ( ) ( ) )

( ( ) ( ( ) ) ( ) )

Spanning TreeParent-child

Canonical string x reverse of the ≦ x

Page 24: Random Generation and Enumeration of Proper Interval Graphs

Parent-Child Relation

Root: ( ( … ( ) ) … ) Parent of canonical string x

Replace the leftmost “) (” of x with “( )” Parent of x is canonical The root is the ancestor of x

( ( ( ( ( ) ) ) ) )

( ( ( ) ) ( ( ) ) )

( ( ( ) ( ) ( ) ) )

( ( ( ( ) ) ( ) ) )

( ( ( ( ) ( ) ) ) )

Page 25: Random Generation and Enumeration of Proper Interval Graphs

Tree (n=5)( ( ( ( ( ) ) ) ) )

( ( ( ( ) ( ) ) ) )

( ( ( ( ) ) ( ) ) )

( ( ( ) ( ) ( ) ) ) ( ( ( ( ) ) ) ( ) )

( ( ( ) ) ( ( ) ) ) ( ( ( ) ( ) ) ( ) )

( ( ( ) ) ( ) ( ) )

( ( ) ( ) ( ) ( ) )

( ( ) ( ( ) ) ( ) )

child parentroot

Enumeration of all the strings by traversing the tree from the root

Find child: O(1) timeOutput only the differencesPrepostorder manner

Output string: O(1) time

Page 26: Random Generation and Enumeration of Proper Interval Graphs

Conclusion and Future Work

Random Generation and Enumeration of Connected Proper Interval Graphs of n vertices Random Generation : O(n+m) time Enumeration : O(1) time/graph n vertices at most ⇒ n vertices

Random Generation and Enumeration of Interval Graphs