Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒...

39
Randomized Algorithms CS648 Lecture 2 β€’ Three interesting problems β€’ Balls into bins β€’ Balls out of bin β€’ Randomized Quick Sort β€’ Random Variable and Expected value 1

Transcript of Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒...

Page 1: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Algorithms CS648

Lecture 2 β€’ Three interesting problems

β€’ Balls into bins β€’ Balls out of bin β€’ Randomized Quick Sort

β€’ Random Variable and Expected value

1

Page 2: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Recap from last lecture

β€’ Probability space (𝛀,P)

β€’ Events

β€’ Probability of union of events

β€’ Partition theorem :

If events 𝐀1,…, 𝐀𝑛partition the sample space 𝛀 then

β€’ Conditional probability

2

P[A|B] = 𝐏[π€βˆ©π]

𝐏[𝐁]

P(AUB) = P(A) + P(B) βˆ’ P(A∩B)

P(B) = P(π€π‘–βˆ©B𝑖 )

Page 3: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

BALLS INTO BINS

3

Page 4: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls into Bins

Ball-bin Experiment: There are π‘š balls and 𝑛 bins.

Each ball selects its bin randomly uniformly and independent of other balls

and falls into it.

Applications: β€’ Hashing

β€’ Load balancing in distributed environment 4

1 2 3 … 𝑖 … 𝑛

1 2 3 4 5 … π‘š βˆ’ 1 π‘š

Page 5: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls into Bins

Question : What is the probability that there is at least one empty bin ?

5

1 2 3 … 𝑖 … 𝑛

1 2 3 4 5 … π‘š βˆ’ 1 π‘š

Page 6: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls into Bins

What is the probability space (Ξ©,P) ?

β€’ | Ξ© | = π‘›π‘š

β€’ P(Ο‰) = 1/ π‘›π‘š for each ωϡ Ξ©

6

1 2 3 … 𝑖 … 𝑛

1 2 3 4 5 … π‘š βˆ’ 1 π‘š

Page 7: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls into Bins

Let us define event 𝑬𝑗𝑖

β€’ Events 𝑬𝑗𝑖 and 𝑬𝑗

π‘˜ are ??

β€’ Events 𝑬𝑗𝑖 and 𝑬𝑙

π‘˜ are ??

β€’ Events 𝑬𝑗𝑖 and 𝑬𝑙

𝑖 are ??

7

1 2 3 … 𝑖 … 𝑛

1 2 3 4 5 … 𝑗 … π‘š βˆ’ 1 π‘š

disjoint

Independent

Independent

: 𝑗th ball falls into 𝑖th bin.

Page 8: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls into Bins

𝑬𝑗𝑖 : 𝑗th ball enters 𝑖th bin.

β€’ Pr[𝑬𝑗𝑖] = ??

β€’ Pr[𝑬𝑗𝑖] = ??

β€’ Pr[𝑖th bin is empty] = ??

=(1 βˆ’ 1

𝑛 )π‘š

8

1𝑛

1 βˆ’1

𝑛

Pr[𝑬1𝑖 βˆ©π‘¬2

𝑖 β€¦βˆ©π‘¬π‘šπ‘–] = Pr[𝑬1

𝑖 ] β¨― …Pr[π‘¬π‘šπ‘–]

1 2 3 4 5 … 𝑗 … π‘š βˆ’ 1 π‘š

1 2 3 … 𝑖 … 𝑛

Page 9: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls into Bins

β€’ Pr[𝑖th bin is empty] = (1 βˆ’ 1

𝑛 )π‘š

β€’ Pr[𝑖th and π‘˜th bin are empty] = ??

β€’ Pr[a specified set of 𝑙 bins are empty] = ??

9

(1 βˆ’ 2𝑛

)π‘š

(1 βˆ’ 𝑙𝑛 )π‘š

1 2 3 … 𝑖 … 𝑛

1 2 3 4 5 … 𝑗 … π‘š βˆ’ 1 π‘š

Page 10: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls into Bins

Question: What is the probability that there is at least one empty bin ?

Attempt 1: Explore the sample space associated with the β€œballs into bins”.

Attempt 2: ??

Define 𝐀𝑖 : β€œπ‘–th bin is empty”

Event β€œthere is at least one empty bin” = 𝐀𝑖𝑛𝑖=1

10

Express the event as union of some events …

Page 11: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls into Bins

Theorem: For events 𝐀1,…, 𝐀𝑛defined over a probability space (𝛀,P), then

P( 𝐀𝑖𝑛𝑖=1 ) = P(𝐀𝑖)𝑖

βˆ’ P(𝐀𝑖 𝐀𝑗 )𝑖<𝑗

+ P(𝐀𝑖 𝐀𝑗 π€π‘˜ )𝑖<𝑗<π‘˜

βˆ’ …

(βˆ’1)𝑛+1 P(𝐀1 𝐀2 … 𝐀𝑛)

--------------------------------------------------------------------

= (𝑛1)(1 βˆ’ 1

𝑛 )π‘š

βˆ’ (𝑛2)(1 βˆ’ 2

𝑛 )π‘š

+ (𝑛3)(1 βˆ’ 3

𝑛 )π‘š

βˆ’ …

+ βˆ’1 π‘˜+1(π‘›π‘˜) (1 βˆ’ π‘˜

𝑛 )π‘š

… 11

𝑝(𝑛,π‘š)

Page 12: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls into Bins

Homework Exercise:

What is the probability that there are exactly π‘˜ empty bins ?

Hint: You will need to use 𝑝(𝑛,π‘š) with suitable values of 𝑛.

12

Page 13: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

BALLS OUT OF BIN

13

Page 14: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls Out of Bin

There is a bin containing π‘Ÿ red balls and 𝑏 blue balls.

Balls are taken out from the bag

Question: What is the probability that appears ahead of all blue balls. ?

14

uniformly randomly and without replacement.

What if π‘Ÿ = 1 ?

Page 15: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls Out of Bin

There is a bin containing 1 red ball and 𝑏 blue balls.

Balls are taken out from the bag

Question: What is the probability that appears ahead of all blue balls ?

Question: What is the probability that appears at π’Šth place ? 15

uniformly randomly and without replacement.

1

𝑏 + 1

1

𝑏 + 1

Page 16: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Balls Out of Bin

There is a bin containing π‘Ÿ red balls and 𝑏 blue balls.

Balls are taken out from the bag

Question: What is the probability that appears ahead of all blue balls ?

Homework: Give formal arguments in support of your answer. 16

uniformly randomly and without replacement.

1

𝑏 + 1

Page 17: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

RANDOMIZED QUICK SORT

17

Page 18: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

18

How to solve a problem ?

Page 19: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Perspective

19

does matter

Page 20: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort

Input: 𝑨[0..𝑛 βˆ’ 1]

RandomizedQuickSort(𝑨,𝒍, 𝒓) //For the first call, 𝒍 =0, 𝒓=𝑛 βˆ’ 1

{ If (𝒍 < 𝒓)

𝒙 an element selected randomly uniformly from 𝑨[𝒍..𝒓];

π’Š Partition(𝑨,𝒍,𝒓,x);

RandomizedQuickSort(𝑨,𝒍, π’Š βˆ’ 𝟏);

RandomizedQuickSort(𝑨,π’Š + 𝟏, 𝒓)

}

Assumption : All elements are distinct (if not, break the ties arbitrarily)

Notation : 𝑒𝑖 : 𝑖th smallest element of array 𝑨.

Question: What is the probability that 𝑒𝑖 is compared with 𝑒𝑗 ?

20

Recall that the execution of RandomizedQuickSort is totally immune to the permutation of 𝑨.

Page 21: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort

Input: 𝑨[0..𝑛 βˆ’ 1]

RandomizedQuickSort(𝑨,𝒍, 𝒓) //For the first call, 𝒍 =0, 𝒓=𝑛 βˆ’ 1

{ If (𝒍 < 𝒓)

𝒙 an element selected randomly uniformly from 𝑨[𝒍..𝒓];

π’Š Partition(𝑨,𝒍,𝒓,x);

RandomizedQuickSort(𝑨,𝒍, π’Š βˆ’ 𝟏);

RandomizedQuickSort(𝑨,π’Š + 𝟏, 𝒓)

}

The sample space : all recursion trees (rooted binary trees on 𝑛 nodes).

21

Page 22: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort

Input: 𝑨[𝟎..𝒏 βˆ’ 𝟏]

RandomizedQuickSort(𝑨,𝒍, 𝒓) //For the first call, 𝒍 =0, 𝒓=𝑛 βˆ’ 1

{ If (𝒍 < 𝒓)

𝒙 an element selected randomly uniformly from 𝑨[𝒍..𝒓];

π’Š Partition(𝑨,𝒍,𝒓,x);

RandomizedQuickSort(𝑨,𝒍, π’Š βˆ’ 𝟏);

RandomizedQuickSort(𝑨,π’Š + 𝟏, 𝒓)

}

22

𝑒4

𝑒2

𝑒1 𝑒3

𝑒6

𝑒5 𝑒7

𝒏 = 7 1

7β‹…1

3β‹…1

3

Page 23: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort

Input: 𝑨[𝟎..𝒏 βˆ’ 𝟏]

RandomizedQuickSort(𝑨,𝒍, 𝒓) //For the first call, 𝒍 =0, 𝒓=𝑛 βˆ’ 1

{ If (𝒍 < 𝒓)

𝒙 an element selected randomly uniformly from 𝑨[𝒍..𝒓];

π’Š Partition(𝑨,𝒍,𝒓,x);

RandomizedQuickSort(𝑨,𝒍, π’Š βˆ’ 𝟏);

RandomizedQuickSort(𝑨,π’Š + 𝟏, 𝒓)

}

23

𝒏 = 7 𝑒5

𝑒6

𝑒7

𝑒2

𝑒1 𝑒4

𝑒3

1

7β‹…1

4β‹…1

2β‹…1

2

Page 24: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort

Question: What is the probability that 𝑒𝑖 is compared with 𝑒𝑗 ?

Attempt 1: Explore the sample space associated with Randomized Quick Sort.

add the probability of each recursion tree in which 𝑒𝑖 is compared with 𝑒𝑗.

Attempt 2: ??

24

View the execution of RandomizedQuickSort from perspective of 𝑒𝑖 and 𝑒𝑗

Not a feasible way to calculate the probability

Page 25: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort from perspective of 𝑒𝑖 and 𝑒𝑗

In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒𝑖 and 𝑒𝑗, we do the following:

β€’ We visualize elements 𝑒1, … , 𝑒𝑛 arranged from left to right in increasing order of values.

β€’ This visualization ensures that the two subarrays which we sort recursively lie to left and right of the pivot element. In this way we can focus on the subarray containing 𝑒𝑖 and 𝑒𝑗easily.

β€’ Note that this visualization is just for the sake of analysis. It will be grossly wrong if you interpret it as if we are sorting an already sorted array.

25

Go through the next few slides slowly and patiently, pondering at each step. Never accept anything until and unless you can see the underlying truth yourself.

Page 26: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort from perspective of 𝑒𝑖 and 𝑒𝑗

26

Elements of A arranged in Increasing order of values

𝑒𝑖 𝑒𝑗

Page 27: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort from perspective of 𝑒𝑖 and 𝑒𝑗

Observation:

𝑒𝑖 and 𝑒𝑗 get compared during an instance of Randomized Quick Sort iff

the first pivot element from 𝑺𝑖𝑗 is either 𝑒𝑖 or 𝑒𝑗.

Let us define two events.

𝐡𝑖 : first pivot element selected from 𝑺𝑖𝑗 during Randomized Quick Sort is 𝑒𝑖.

𝐡𝑗 : first pivot element selected from 𝑺𝑖𝑗 during Randomized Quick Sort is 𝑒𝑗.

Pr[𝑒𝑖 and 𝑒𝑗 get compared] = ??

27

𝑒𝑖 𝑒𝑗

𝑺𝑖𝑗

Pr[𝐡𝑖U𝐡𝑗]

Page 28: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort from perspective of 𝑒𝑖 and 𝑒𝑗

Pr[𝑒𝑖 and 𝑒𝑗 get compared] = Pr[𝐡𝑖U𝐡𝑗]

= Pr[𝐡𝑖] + Pr[𝐡𝑗] - Pr[𝐡𝑖 βˆ©π΅π‘—]

= Pr[𝐡𝑖] + Pr[𝐡𝑗]

= 1

π‘—βˆ’π‘–+1 + 1

π‘—βˆ’π‘–+1

= 2

π‘—βˆ’π‘–+1

28

𝑒𝑖 𝑒𝑗

𝑺𝑖𝑗

What relation exists between 𝐡𝑖 and 𝐡𝑗 ?

𝐡𝑖 and 𝐡𝑗 are disjoint events.

What is Pr[𝐡𝑖] ? Pr[𝐡𝑖] =

1

|𝑺𝑖𝑗|.

Page 29: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Randomized Quick Sort from perspective of 𝑒𝑖 and 𝑒𝑗

Theorem: During Randomized-Quick-Sort on 𝑛 elements,

the probability 𝑒𝑖 and 𝑒𝑗 are compared with probability 2

π‘—βˆ’π‘–+1 .

Inferences: β€’ Probability depends upon the rank separation 𝑗 βˆ’ 𝑖 + 1

β€’ Probability ----------?----------- the size of the array.

β€’ Probability 𝑒𝑖 and 𝑒𝑖+1 are compared = ? .

β€’ Probability of comparison of 𝑒0 and π‘’π‘›βˆ’1 = ? .

29

is independent of

1 2

𝑛

Page 30: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

PROBABILITY THEORY

β€’ Random variable

and

β€’ expected value

30

Page 31: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Random variable

31

Randomized-Quick-Sort

on array of size n

Number of HEADS in 5 tosses

Sum of numbers in 4 throws

Number of comparisons

Page 32: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Random variable

Definition: A random variable defined over a probability space (Ξ©,P)

is a mapping Ξ© R.

β€’ 𝑿(Ο‰) : the value of 𝑿 on elementary event Ο‰ ∈ 𝛀 .

Notations for random variables :

β€’ 𝑿, 𝒀, 𝑼, …(capital letters)

32

Ξ©

R

Set of real numbers

𝑿

Page 33: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Many Random Variables for the same Probability space

Random Experiment: Throwing a dice two times

β€’ X : the largest number seen

β€’ Y : sum of the two numbers seen

33

X(Ο‰) = 6 Ο‰

Y(Ο‰) = 9

Page 34: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Expected Value of a random variable (average value)

Definition: Expected value of a random variable X defined over a probability space (Ξ©,P) is

E[X] = X(Ο‰) β¨― P(Ο‰)ωϡ Ξ©

34

Ξ©

X= a X= b

X= c

E[X] = a⨯ P(X = a)aϡ X

Page 35: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Examples

Random experiment 1: A fair coin is tossed n times

Random Variable X: The number of HEADS

E[X] = 𝑖 β¨― P(X =𝑖)𝑖

= 𝑖 ⨯𝑛𝑖𝑖 (1 2 )

𝑖 (1 2 )π‘›βˆ’π‘–

= 𝑛 2

Random Experiment 2: 4 balls into 3 bins

Random Variable X: The number of empty bins

E[X] = 𝑖 β¨― P(X =𝑖)𝑖

35

Page 36: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Can we solve these problems ? Random Experiment 1 : There are π‘š balls and 𝑛 bins.

Each ball falls into a bin selected randomly uniformly and independently.

Random Variable X: The number of empty bins

E[X]= ??

Random Experiment 2 : A bin contains π‘Ÿ red balls and 𝑏 blue balls in a bin.

The balls are taken out randomly uniformly without replacement.

Random Variable X: The number of red balls preceding all blue balls.

E[X]= ??

Random Experiment 3 Randomized Quick sort on 𝑛 elements Random Variable X: The number of comparisons

E[X]= ??

36

Page 37: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

β€’ Spend at least 2 hours today trying to solve the 3 problems given in the previous slide.

β€’ These 2 hours will be very valuable for you in the long run.

I really mean it.

37

Page 38: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Fun with probability

38

Page 39: Randomized Algorithms - ict.iitk.ac.inΒ Β· Randomized Quick Sort from perspective of 𝑒 and 𝑒 In order to analyze the Randomized Quick Sort algorithm from the perspective of 𝑒

Stick problem

We break the stick at 𝒏 points selected randomly uniformly.

39

What is the probability that the 𝒏 + 𝟏 pieces can be joined to form a polygon ?