lecture 10-cs648=2013
TRANSCRIPT
![Page 1: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/1.jpg)
Randomized AlgorithmsCS648
Lecture 10
Random Samplingpart-II
(To find a subset with desired property)
1
![Page 2: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/2.jpg)
Overview
• There is a huge list (1 million) of blood donors.
• Unfortunately the blood group information is missing at present.
• We need a donor with blood group O+.
• What to do ?
Solution: (Select a random subset of donors.)
Repeat until we get a donor of blood group O+.
{ Pick phone number of a donor randomly uniformly
Call him to ask his Blood group.
}
![Page 3: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/3.jpg)
Random Sampling
• Suppose there is a computational problem where we require to find a subset with some desired properties.
• Unfortunately, computing such a set deterministically may take huge time.
• Random sampling carried out suitably may produce a subset with the desired property with some probability.
![Page 4: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/4.jpg)
RANDOMIZED ALGORITHM FOR BPWM PROBLEM
![Page 5: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/5.jpg)
Integer Product of Matrices
1 0 0 1 0
1 0 0 0 1
0 0 1 0 0
0 1 0 1 0
1 1 0 1 0
1 0 1 0 0
0 1 1 0 1
1 1 1 1 0
1 1 1 0 0
1 0 0 1 0
2 1 2 0 0
2 0 1 0 0
1 1 1 1 0
1 2 2 0 1
2 2 3 0 1
A B D
![Page 6: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/6.jpg)
Boolean Product of Matrices
1 0 0 1 0
1 0 0 0 1
0 0 1 0 0
0 1 0 1 0
1 1 0 1 0
1 0 1 0 0
0 1 1 0 1
1 1 1 1 0
1 1 1 0 0
1 0 0 1 0
1 1 1 0 0
1 0 1 0 0
1 1 1 1 0
1 1 1 0 1
1 1 1 0 1
A B C
![Page 7: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/7.jpg)
Boolean Product of Matrices
1 0 0 1 0
1 0 0 0 1
0 0 1 0 0
0 1 0 1 0
1 1 0 1 0
1 0 1 0 0
0 1 1 0 1
1 1 1 1 0
1 1 1 0 0
1 0 0 1 0
1 1 1 0 0
1 0 1 0 0
1 1 1 1 0
1 1 1 0 1
1 1 1 0 1
A B C
![Page 8: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/8.jpg)
Boolean Product Witness Matrix (BPWM)
![Page 9: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/9.jpg)
MOTIVATION FOR BPWM
![Page 10: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/10.jpg)
All Pairs Shortest Paths (APSP)
![Page 11: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/11.jpg)
All Pairs Shortest Paths (APSP)Students having interest in algorithms are strongly advised to study this novel algorithm from Motwani-Raghwan book or the original journal version. (This is, of course, not part of the syllabus for CS648)
![Page 12: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/12.jpg)
RANDOMIZED ALGORITHM FOR BPWM
![Page 13: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/13.jpg)
Boolean Product Witness Matrix (BPWM)
![Page 14: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/14.jpg)
Boolean Product of Matrices
1 0 0 1 0
1 0 0 0 1
0 0 1 0 0
0 1 0 1 0
1 1 0 1 0
1 0 1 0 0
0 1 1 0 1
1 1 1 1 0
1 1 1 0 0
1 0 0 1 0
1 1 1 0 0
1 0 1 0 0
1 1 1 1 0
1 1 1 0 1
1 1 1 0 1
A B C
2 1 2 0 0
2 0 1 0 0
1 1 1 1 0
1 2 2 0 1
2 2 3 0 1
D
Look carefully at the integer product matrix D. Does it have any thing to do with
witnesses.
![Page 15: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/15.jpg)
Boolean Product of Matrices
1 0 0 1 0
1 0 0 0 1
0 0 1 0 0
0 1 0 1 0
1 1 0 1 0
1 0 1 0 0
0 1 1 0 1
1 1 1 1 0
1 1 1 0 0
1 0 0 1 0
2 1 2 0 0
2 0 1 0 0
1 1 1 1 0
1 2 2 0 1
2 2 3 0 1
A B D
![Page 16: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/16.jpg)
Boolean Product of Matrices
1 0 0 1 0
1 0 0 0 1
0 0 1 0 0
0 1 0 1 0
1 1 0 1 0
1 0 1 0 0
0 1 1 0 1
1 1 1 1 0
1 1 1 0 0
1 0 0 1 0
2 1 2 0 0
2 0 1 0 0
1 1 1 1 0
1 2 2 0 1
2 2 3 0 1
A B D
1 2 3 4 5
⨯ ⨯ ⨯ ⨯ ⨯
There is a way to manipulate A so that D will store a witness for all those pairs which have singleton
witness. Can you guess ?
![Page 17: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/17.jpg)
Boolean Product of Matrices
1 0 0 1 0
1 0 0 0 1
0 0 1 0 0
0 1 0 1 0
1 1 0 1 0
1 0 1 0 0
0 1 1 0 1
1 1 1 1 0
1 1 1 0 0
1 0 0 1 0
2 4 2 0 0
2 0 1 0 0
3 3 3 3 0
2 2 2 0 2
2 2 3 0 2
A B D
1 2 3 4 5
⨯ ⨯ ⨯ ⨯ ⨯
![Page 18: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/18.jpg)
Boolean Product of Matrices
1 0 0 1 0
1 0 0 0 1
0 0 1 0 0
0 1 0 1 0
1 1 0 1 0
1 0 1 0 0
0 1 1 0 1
1 1 1 1 0
1 1 1 0 0
1 0 0 1 0
5 4 5 0 0
6 0 1 0 0
3 3 3 3 0
2 6 6 0 2
5 6 7 0 2
A B D
1 2 3 4 5
⨯ ⨯ ⨯ ⨯ ⨯
![Page 19: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/19.jpg)
Algorithm for Computing Singleton Witnesses
![Page 20: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/20.jpg)
Algorithm Design for BPWM
![Page 21: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/21.jpg)
![Page 22: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/22.jpg)
1 0 1 1 1 0 0 1 0 1
1
1
0
1
1
0
1
1
0
0
1 2 3 4 … n⨯ ⨯ ⨯ ⨯ ⨯⨯ ⨯ ⨯ ⨯ ⨯
A B
![Page 23: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/23.jpg)
1 0 1 1 1 0 0 1 0 1
1
1
0
1
1
0
1
1
0
0
1 2 3 4 … n⨯ ⨯ ⨯ ⨯ ⨯⨯ ⨯ ⨯ ⨯ ⨯
A B
![Page 24: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/24.jpg)
1 0 1 1 1 0 0 1 0 1
1
1
0
1
1
0
1
1
0
0
1 2 3 4 5 … n-1 n⨯ ⨯ ⨯ ⨯ ⨯⨯ ⨯ ⨯ ⨯ ⨯
A B
![Page 25: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/25.jpg)
1 0 1 1 1 0 0 1 0 1
1
1
0
1
1
0
1
1
0
0
0 2 3 0 5 … n-1 0⨯ ⨯ ⨯ ⨯ ⨯⨯ ⨯ ⨯ ⨯ ⨯
A B
![Page 26: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/26.jpg)
No idea!Let us ask the following related but easier
question.
![Page 27: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/27.jpg)
![Page 28: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/28.jpg)
![Page 29: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/29.jpg)
![Page 30: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/30.jpg)
![Page 31: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/31.jpg)
![Page 32: Lecture 10-cs648=2013](https://reader034.vdocument.in/reader034/viewer/2022052601/5597df521a28ab64388b477d/html5/thumbnails/32.jpg)
Conclusion
A sketch of the solution for Question 1 was given in the class. The students are encouraged to work out the exact details. The solution
will be presented in the beginning of next lecture class.