Date post: | 17-Jan-2018 |
Category: |
Documents |
Upload: | daniella-mccoy |
View: | 227 times |
Download: | 0 times |
Space Efficient and Output Sensitive Greedy Algorithms on IntervalsToshiki Saitoh (Kobe University)
Joint work with・ Takashi Horiyama (Saitama University)・ David G. Kirkpatrick (UBC)・ Yota Otachi (JAIST)・ Ryuhei Uehara (JAIST)・ Yushi Uno (Osaka Prefecture University)・ Katsuhisa Yamanaka (Iwate University)
Background• There are many big data
• We need to process big data, efficiently.• Big data is too big!
• We cannot read the data at once.
Polynomial space algorithms do not work!
We have to consider machine models with space constraint
Machine Model with Space Constraint• Streaming model
• Online algorithms• Multi-pass algorithms
• Read-only random-access model• Input: read-only and random-access media• Workspace: random-access, but O(s) extra workspace (s<n)• Output: write-only media• There are many results for sorting and selection
• Time-space tradeoff
We try to study more general problems!
Our Results• Algorithms on Intervals
• Maximum independent set• Minimum dominating set
• Connected dominating set • Paired dominating set
• etc.
• These algorithms are • Greedy• Space efficient
• Memory adjustable priority queues [Asano et al. 2013]• Output sensitive
• Running time depends on the output size
To achieve output sensitiveness, we propose
a new operation and its analysis
This talk!
Maximum Independent Set on Intervals
• Independent set on intervals• Set of intervals such that two distinct intervals do not intersect
• Maximum independent set problem on intervals• Input: A set of intervals• Output: Maximum cardinality independent set (unweighted)
Independent set
Maximum one
Algorithms (Known and Ours)Time Space Idea
Greedy O(n log n) O(n) words Sorting
Snoeyink [2004] O(n log k) O(n) words Divide and
Conquer
Bhattacharya et al. [2014] O(n’ (log s + n/s)) O(s) words Heap
Ours 1 O(n’ (log sk/n + n/s)) O(s) words Tournament Trees
Ours 2 O(n’’ (log wsk/n + n/(ws)))
O(s) words = O(ws) bits
Navigation PilesTrigger Piles
n: # input intervals, k: output size1 word = w bits (w>log n)n’ = min{n, sk}, n’’ = min{n, wsk}
Greedy Algorithm1. Sort the intervals according to their right and r = -∞2. While there exists a candidate do3. Extract an interval I with minimum right4. If l(I) > r then output I and set r = r(I)
12
34
5
6
7
8
910
11
Input array (Read only) 5 8 1 3 10 7 9 2 11 4 6
1 2 3 4 5 6 7 8 9 10 11
Sorting
O(n) workspace
r : the right of the last output interval
• Workspace: O(s) words
• Min-heap H• The size of the heap is O(s)
• Complete binary tree with s nodes• Partition the input into s blocks• At most one interval from each block is in
the heap H• Key: right endpoint• Validity: Left endpoint is larger than r
• r is the right of the last output interval• Each internal node has smaller
element of its children… … …… …B1 B2 Bs
…
Min-heapsize O(s)
Bhattacharya’s Algorithm (1)
… … …… …B1 B2 Bs
…
r
Min-heapsize O(s)
Bhattacharya’s Algorithm (2)1. Initialize the heap H and r=-∞2. While H is not empty do3. Pop an interval I with minimum right in H4. if I does not contain r then5. Output I and update r6. Search a next interval J from the block
which include INext interval J has min-right such that l(J)>r7. Push J into the heap H
Bhattacharya’s Algorithm (3)
Computation time: O(min{n, sk}(log s+n/s))
• Pop and Push operation: O(log s) time• Search operation: O(n/s) time• #while loop iterations: min {n, sk}
• n: Each element is pushed into the heap at most once
• sk: Output at least one element after s time loop
… … …… …B1 B2 Bs
n/s n/s n/s
Min-heapsize O(s)
…
log s
Redundant!
1. Initialize the heap H and r=-∞2. While H is not empty do3. Pop an interval I with minimum right in H4. if I does not contain r then5. Output I and update r6. Search a next interval J from the block
which include INext interval J has min-right such that l(J)>r7. Push J into the heap H
ResultsTime Space Idea
Greedy O(n log n) O(n) words Sorting
Snoeyink [2004] O(n log k) O(n) words Divide and
Conquer
Bhattacharya et al. [2014] O(n’ (log s + n/s)) O(s) words Heap
Ours 1 O(n’ (log sk/n + n/s)) O(s) words Tournament Trees
Ours 2 O(n’’ (log wsk/n + n/(ws)))
O(s) words = O(ws) bits
Navigation PilesTrigger Piles
n: # input intervals, k: output size1 word = w bitsn’ = min{n, sk}, n’’ = min{n, wsk}
• Workspace: O(s) words• [Asano et al. 2013]
• Min-tournament tree• Complete binary tree with s leaves
• #nodes: 2s-1• Partition the input into s blocks
• Each leaf corresponds to a block• At most one interval from each block is in
the tree• Key: right endpoint• Validity: Left endpoint is larger than r
• Each internal node has minimum element in its children
… … …… …B1 B2 Bs
…
…
Tournament Trees
After Output One Interval• Naïve update process
• Extract the root interval• Find a next interval in the corresponding block• Update nodes in the path from the leaf to the root
• Our update procedure• Bottom up and recursive update
• Updating intervals from the leaf to the root• If there is an invalid interval in the
updating path, then we refresh it recursively.… …
invalid
Bi
The root interval might be invalid!Valid interval: No intersection with outputted intervals
After refresh, the root interval is valid.Lemma 1
Our algorithm 11. Initialize the tournament tree T and r=-∞2. While T is not empty do3. Output an interval I in the root of T and update
r4. Refresh at the root of T
Let T’ be a binary tree with height h and s’ leaves. The number of nodes in T’ is O(s’ log 2h/s’).
Lemma 2
invalid
(Intuitive proof)• Maximizing the number of nodes
hlog s’
h - log s’
2s’-1
s’ (h – log s’) = s’ log 2h/s’
s’
Our algorithm 1
• #iteration: k = output size• Let si be #updated leaves in i th loop• Refresh cost: O(si log s/si + si n/s)
• Updating cost: O(si log s/si)• from Lemma 2, h=log s, s’=si
• Search cost: O(si n/s)
•
1. Initialize the tournament tree T and r=-∞2. While T is not empty do3. Output an interval I in the root of T and update
r4. Refresh at the root of T
Let T’ be a binary tree with height h and s’ leaves. The number of nodes in T’ is O(s’ log 2h/s’).
Lemma 2
invalid
Time complexity
ResultsTime Space Idea
Greedy O(n log n) O(n) words Sorting
Snoeyink [2004] O(n log k) O(n) words Divide and
Conquer
Bhattacharya et al. [2014] O(n’ (log s + n/s)) O(s) words Heap
Ours 1 O(n’ (log sk/n + n/s)) O(s) words Tournament Trees
Ours 2 O(n’’ (log wsk/n + n/(ws)))
O(s) words = O(ws) bits
Navigation PilesTrigger Piles
n: # input intervals, k: output size1 word = w bitsn’ = min{n, sk}, n’’ = min{n, wsk}
Conclusion and Future Works• New operation and its analysis for priority queues• Algorithms on intervals
• Maximum independent set• Minimum dominating set
• Connected dominating set• Paired dominating set
• etc.
• Future Works• Independent dominating set on intervals• Weighted problems• Implementation of these algorithms
Running time are same