Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota...

24
Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC, Japan) Ryuhei Uehara (JAIST, Japan) 1

Transcript of Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota...

Page 1: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Random Generation and Enumeration of Bipartite Permutation Graphs

Toshiki Saitoh (JAIST, Japan)

Yota Otachi (Gunma Univ., Japan)

Katsuhisa Yamanaka (UEC, Japan)

Ryuhei Uehara (JAIST, Japan)

1

Page 2: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Motivation

Input graphs Interval graphs Permutation graphs

Computer experiment

Input Output

Proper interval graphsBipartite permutation graphs

[Saitoh et al. 09]

Random generation Enumeration

We want suitable test data …

Enumerate all object

Generate an objectuniformly at random

2

Page 3: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Our Algorithms

Random Generation of connected bipartite permutation graphs Input : natural number n Output : a connected bipartite permutation graph with n vertices

An output graph is chosen uniformly at random (the graph is non-labeled) Based on counting of the graphs The number of operation: O(n)

Enumeration of connected bipartite permutation graphs Input : natural number n Output : all connected bipartite permutation graphs with n vertices

Without duplications ( graphs are non-labeled ) Based on the reverse search [Avis, Fukuda, 96] Running time: O(1) time / graph

3

Page 4: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Permutation Graphs A graph is called a permutation graph

if the graph has a line representation

1 2 3 4 5 6

3 6 4 1 5 2

1

23

4

5

6

Line representation Permutation Graph

(also, permutation diagraph)

4

Page 5: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Bipartite Permutation Graphs A permutation graph is called

a bipartite permutation graph if the graph is bipartite

1

2

3 4

5

6 1 2 3 4 5 6 7 8

3 5 6 1 2 8 4 7

78

Bipartite permutation graph

Line representation

Random generation and enumeration of bipartite permutation graphs

Random generation and enumeration of bipartite permutation graphs 5

: vertices in a set Y: vertices in a set X

Page 6: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Useful Property of Connected Bipartite Permutation Graphs

1 2 3 4 5 6 7 8

3 5 6 1 2 8 4 7

1

2

3 4

5

6

78

Bipartite permutation graphLine representation

1 1 1 0 0 1 0 0

1 1 0 1 0 0 1 0

Line representationLine representation

(0, 0)0

Dyck path

6

Lemma 1In a line representation

Blue line (corresponds to a vertex in X): from upper left to lower right

Red line (corresponds to a vertex in Y): from upper right to lower left

Any two lines with the same color have no intersection

0-1 binary string0-1 binary string Dyck pathDyck path

Page 7: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

How to Construct Dyck Path from 0-1 Binary String

1 1 0 1 0

1 1 0 0 0

(0, 0)0

7

Sweep the two lines alternately

‘1’ ⇒ go right and go up‘0’ ⇒ go right and go down

For each character,

Page 8: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Bipartite Permutation Graph with n Vertices

Property of Dyck path The last coordinate is (2n, 0)

The upper / lower lines haven ‘1’s and n ‘0’s

Located on the upper side of x-axis

The points on x-axis are boundaries of connected component of the graph

0

1 1 0 1 0 1 0

1 1 0 0 0 1 0

(0, 0)

(2n, 0)

8

A (non-connected) graph

line rep.

Dyck path

Page 9: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Connected Bipartite Permutation Graph with n Vertices

y = 0

1 1 0 1 0 0 1 0

1 1 1 0 0 1 0 0

y = 1

9

Property of Dyck pathThe last coordinate is (2n, 0)

The upper / lower lines haven ‘1’s and n ‘0’s

Located on the upper side ofx-axis

For all points except (0,0) and (2n,0), its value of y-coordinate is equal or greater than 1

A graph

line rep.

Dyck path

Page 10: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Connected Bipartite Permutation Graph with n Vertices

1 1 0 1 0 0 1 0

1 1 1 0 0 1 0 0

y = 1

10

Property of Dyck pathThe last coordinate is (2n, 0)

The upper / lower lines haven ‘1’s and n ‘0’s

Located on the upper side ofx-axis

For all points except (0,0) and (2n,0), its value of y-coordinate is equal or greater than 1

A graph

line rep.

Dyck path

For random generation, it is sufficientto generate a Dyck path randomly?

For random generation, it is sufficientto generate a Dyck path randomly? NoNo

Page 11: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

One line rep.Two line reps.

The Reason of “No” There is no 1 to 1 correspondence

between connected bipartite permutation graphs and their line representations

11

A graph corresponds to at most four line representations

Four line reps.

Examples

Page 12: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Equivalent Line Representations

horizontal-flip

Vertical-flip

horizontal-flip

Vertical-flip

Rotation

This graph corresponds to four line representationsThis graph corresponds to four line representations

Lemma 2

There exists at most four line representations for any connected bipartite permutation graph

Page 13: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

horizontal-symmetric

Vertical-flip

Vertical-flip

horizontal-flip

horizontal-symmetric

13

Equivalent Line Representations

Lemma 2

There exists at most four line representations for any connected bipartite permutation graph

This graph corresponds to two line representationsThis graph corresponds to two line representations

Page 14: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Rotational-symmetricline representation

Vertical-symmetricline representation

14Corresponding graphs have two line representations resp.Corresponding graphs have two line representations resp.

Other examples:

EquivalentLine Representations

Lemma 2

There exists at most four line representations for any connected bipartite permutation graph

Page 15: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

1 to 1

Bipartite Permutation GraphHorizontal, vertical, rotational-symmetricline representation

15

Equivalent Line Representations

Lemma 2

There exists at most four line representations for any connected bipartite permutation graph

This graph have one line representationThis graph have one line representation

Page 16: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Generate a Line Representation Randomly

A set of line representationsHorizontal-symmetric

Vertical-symmetric

Rotational-symmetric

If we generate a line representation randomly,

A graph corresponding to four line reps. is frequently generatedA graph corresponding to four line reps. is frequently generated

H-, V-, R-symmetric

16

H, V, R-symmetric: Horizontal-,Vertical-,

Rotational-symmetric

Page 17: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Horizontal-symmetric

To avoid such problem, decrease the probability to generate graphs corresponding to two or four line reps.? generate only canonical forms ?

These methods seem not to work … 17

A set of line representations

Vertical-symmetric

Rotational-symmetric

H-, V-, R-symmetric

Generate a Line Representation Randomly

Page 18: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Our Approach:Normalization of Probability

Any graph corresponds tothe four line representations

Horizontal-symmetric

H-, V-, R-symmetric

H-, V-, R-symmetric

Rotational-symmetric

H-, V-, R-symmetric

Vertical-symmetric

Counting groups

Our random generation:

1. Choose one among 4 groups

2. Randomly generate the chosen one18

A set of line representations

Horizontal-symmetric

Rotational-symmetric

Vertical-symmetric

H-, V-, R-symmetric

Page 19: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Counting All Line Representations

The number of Dyck paths of length 2n – 2

= C(n-1)

y = 0y = 1

19

All line representations

n

n

nnC

2

1

1)(Catalan number:

Dyck paths of length 2n – 2

correspondence

A line representations

Page 20: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Counting Rotational-symmetric Line Representations

A rotational-symmetric line reps.

y = 1

The number of

  symmetric Dyck paths   of length 2n – 2

2/)1(

1

n

n

20

Rotational-symmetric line reps.

Symmetric Dyck paths of length 2n – 2

correspondence

Page 21: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Counting Vertical-symmetricLine Representations

Vertical-symmetric line reps

1 1 1 0 0 1 0 0

1 1 1 0 0 1 0 0

y = 1

The number of

  Dyck paths of length n – 2 = C(n/2-1)

21

Vertical-symmetric line reps.

Dyck paths of length n – 2

correspondenceThe upper string is identical to the lower one

n

n

nnC

2

1

1)(Catalan number:

Page 22: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Counting Horizontal-symmetricLine Representations

1 1 1 0 1 0 0 0

1 1 0 0 1 1 0 0

Rotational-symmetric line reps.

1 1 1 0 1 1 0 0

1 1 0 0 1 0 0 0

horizontal-symmetric line reps.

y = 1

22

Horizontal-symmetric line reps.

Rotational-symmetric line reps.(2-Motzkin path)

correspondence

H-symmetricline reps.

R-symmetricline reps.

The number of The number of

=

2/)1(

1

n

n=

Page 23: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Horizontal-symmetric

H-, V-, R-symmetric

H-, V-, R-symmetric

Rotational-symmetric

H-, V-, R-symmetric

Vertical-symmetric

A set of line representations

Horizontal-symmetric

Rotational-symmetric

Vertical-symmetric

H-, V-, R-symmetric

Random Generation

Our random generation:

1. Choose one among 4 groups

2. Randomly generate the chosen one

O(n) operations

O(n) spaceSee:[Saitoh et al. 2009] 23

Page 24: Random Generation and Enumeration of Bipartite Permutation Graphs Toshiki Saitoh (JAIST, Japan) Yota Otachi (Gunma Univ., Japan) Katsuhisa Yamanaka (UEC,

Conclusions and Future Works

24

For bipartite permutation graphs,we have designed the following two algorithms

Random generation algorithm: O(n+m) timeEnumeration algorithm: O(1) time / graph

Random generation and enumeration of permutation graphs

Random generation and enumeration of interval graphs

Conclusions

Future works