List Ranking Moon Jung Chung

Slides:



Advertisements
Similar presentations
Parallel List Ranking Advanced Algorithms & Data Structures Lecture Theme 17 Prof. Dr. Th. Ottmann Summer Semester 2006.
Advertisements

Linked List Ranking Parallel Algorithms 1. Work Analysis – Pointer Jumping Number of Steps: Tp = O(Log N) Number of Processors: N Work = O(N log N) T1.
1 Parallel Algorithms (chap. 30, 1 st edition) Parallel: perform more than one operation at a time. PRAM model: Parallel Random Access Model. p0p0 p1p1.
Algorithms (and Datastructures) Lecture 3 MAS 714 part 2 Hartmut Klauck.
1 Maximal Independent Set. 2 Independent Set (IS): In a graph G=(V,E), |V|=n, |E|=m, any set of nodes that are not adjacent.
Graph Searching CSE 373 Data Structures Lecture 20.
CSE 373: Data Structures and Algorithms Lecture 19: Graphs III 1.
CPSC 689: Discrete Algorithms for Mobile and Wireless Systems Spring 2009 Prof. Jennifer Welch.
Noga Alon Institute for Advanced Study and Tel Aviv University
1 Maximal Independent Set. 2 Independent Set (IS): In a graph, any set of nodes that are not adjacent.
Parallel prefix sum computation Lecture 7. 2 Prefix sum.
Randomized Algorithms and Randomized Rounding Lecture 21: April 13 G n 2 leaves
Parallel Prefix and Data Parallel Operations Motivation: basic parallel operations which occurs repeatedly. Let ) be an associative operation. (a 1 ) a.
Theta Function Lecture 24: Apr 18. Error Detection Code Given a noisy channel, and a finite alphabet V, and certain pairs that can be confounded, the.
Complexity 1 Mazes And Random Walks. Complexity 2 Can You Solve This Maze?
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Randomness in Computation and Communication Part 1: Randomized algorithms Lap Chi Lau CSE CUHK.
1 Introduction to Approximation Algorithms Lecture 15: Mar 5.
Fall 2008Paradigms for Parallel Algorithms1 Paradigms for Parallel Algorithms.
Advanced Topics in Algorithms and Data Structures 1 Two parallel list ranking algorithms An O (log n ) time and O ( n log n ) work list ranking algorithm.
Chapter 9: Graphs Spanning Trees Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
CS261 Data Structures DFS and BFS – Edge List Representation.
Distributed Coloring Discrete Mathematics and Algorithms Seminar Melih Onus November
1 Introduction to Approximation Algorithms. 2 NP-completeness Do your best then.
Graph Algorithms. Definitions and Representation An undirected graph G is a pair (V,E), where V is a finite set of points called vertices and E is a finite.
A graph problem: Maximal Independent Set Graph with vertices V = {1,2,…,n} A set S of vertices is independent if no two vertices in S are.
1 Combinatorial Problem. 2 Graph Partition Undirected graph G=(V,E) V=V1  V2, V1  V2=  minimize the number of edges connect V1 and V2.
Sorting What makes it hard? Chapter 7 in DS&AA Chapter 8 in DS&PS.
CS774. Markov Random Field : Theory and Application Lecture 02
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
Data Structures and Algorithms in Parallel Computing Lecture 2.
Breadth-first and depth-first traversal Prof. Noah Snavely CS1114
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
CSE 421 Algorithms Richard Anderson Lecture 27 NP-Completeness Proofs.
CSE 421 Algorithms Richard Anderson Autumn 2015 Lecture 5.
3/12/2013Computer Engg, IIT(BHU)1 PRAM ALGORITHMS-1.
CSE 373 Data Structures and Algorithms
Lecture 3: Parallel Algorithm Design
PRAM Model for Parallel Computation
CONNECTED-COMPONENTS ALGORITHMS FOR MESH-CONNECTED PARALLEL COMPUTERS
CS137: Electronic Design Automation
CS 1114: Implementing Search
Computing Connected Components on Parallel Computers
Parallel Algorithms (chap. 30, 1st edition)
CSE373: Data Structures & Algorithms Lecture 13: Topological Sort / Graph Traversals Kevin Quinn Fall 2015.
Graph Searching.
Parallel Graph Algorithms
PRAM Model for Parallel Computation
CHAPTER 30 (in old edition) Parallel Algorithms
Data Structures – Stacks and Queus
CSE 373 Data Structures and Algorithms
Search Related Algorithms
Elementary Graph Algorithms
CSE838 Lecture notes copy right: Moon Jung Chung
CSE 373 Data Structures Lecture 16
Richard Anderson Autumn 2016 Lecture 5
Unit –VIII PRAM Algorithms.
CSE 373: Data Structures and Algorithms
Richard Anderson Winter 2009 Lecture 6
CSE 373: Data Structures and Algorithms
CSE 373 Data Structures and Algorithms
CSE 373: Data Structures and Algorithms
Parallel Graph Algorithms
Richard Anderson Winter 2019 Lecture 6
Richard Anderson Winter 2019 Lecture 5
Lecture 21 Amortized Analysis
CSE 5290: Algorithms for Bioinformatics Fall 2009
Chapter 9: Graphs Spanning Trees
Richard Anderson Autumn 2015 Lecture 6
Presentation transcript:

List Ranking Moon Jung Chung CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

Pointer Jumping Review How to compute a prefix on a linked list? If NEXT[i] != NILL then X[i] <- X[i] + X[NEXT[i]] NEXT[i] <- NEXT[NEXT[i]] 1 2 3 4 5 6 7 10 14 18 22 13 7 3 5 9 11 28 27 25 work O(nlogn) is not optimal CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

Pointer Jumping Review How to compute a prefix on a linked list? 1 2 3 4 5 6 7 3 2 7 4 11 6 7 10 2 7 4 18 6 7 28 27 25 22 18 13 7 A node does not not jump if it is jumped over. How to know to jump or not? CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

Random Pointer Jumping female male pointer jump only if female-male 1 2 3 4 5 6 7 8 1 3 5 8 2 4 6 7 A->B->C is jumped to A->C. B is jumped over. No jump crossing. i.e., A-> B->C and B->C->D simultaneously Once a node is jumped over, the node becomes inactive. In reconstruction phase, process are activated in reverse order. CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

Random list ranking algorithm rank[i] = 1, active[i] = true, t=1 in parallel while next[head] != nil { if (active[i] and next[i]!= nil) { sex[i] = random {M,F} if sex[i] = F and sex[next[i]] = M { time[next[i]] = t active[next[i]] = false rank[i] = rank[i] + rank[next[i]] next[i] = next[next[i]] } t++ for k=t down to 1 {if (time[i] = t and next[i] != nil) CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

complexity of easy random list ranking Prob that a cell is not jumped over: 3/4 Probability that a cell is not jumped over after k-iteration: (3/4)k Pi: cell is not not jumped over after k rounds. At least one cell is not jumped over after k rounds: = P1  P2 ...  Pn  P1 + P2 ... + Pn = 1/n(c-1) if we choose (3/4)k < 1/nc So, for (3/4)k < 1/nc <=> k = clog 4/3n, the error that it goes more than clog 4/3n rounds becomes 0. CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

Random ranking algorithm with O(n/logn) PEs, O(logn) time Shared memory model each processor handles logn cell as a queue processor only look at the top of the queue jump over top i only if j=prev[i] is top. Then nex[j] = next[i] and remove top from the queue Still has memory imbalance Each PE can splice out: Slice_out(i) prev[next[i]] = prev[i] and next[ptev[i]] = next[i] rank[prev[i]] = rank[prev[i]]+ rank[i] if next[i] != nil then prev[next[i]] = prev[i] CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

CSE838 Lecture notes copy right: Moon Jung Chung Algorithm Initially: rank[i,k] = 1, sex[i,k] = F top[i] = Q[i].1 // Queue of PE i’s 1st element. sex[nil] = M t=1 while next[head] != nil { if position of top[i]  logn { sex[top[i]] = random{M,F} if (sex[prev[top[i]]] = F and sex[top[i]] = M { spliceout(top[i]) position of top[i] points next in the queue of PE i splicetime[top[i]] = t } t++; Observation: Prob. that a particular queue is not empty after 16logn rounds is < 1/n. Theorem: Expected running time is O(logn) CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

Optimal Deterministic List Ranking Algorithm How to pick 1/4 PEs with guarantee? k-Ruling set: G=(V,E) be the directed graph representation of a linked list L with vertices v1,...,vn. A subset S of V is a ruling set if 1. No two vertices in S are adjacent. 2. For each vertex vi in V, there is a directed path from some vertex in S to vi with length at most k. S: head of each segment of linked list, k is the length from the ruler. If we have a k-ruling set, every time we can select rulers (n/k elements) without conflict. Observation: k-coloring of a linked list can be converted into k-ruling set. How to find k-ruling set? CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

Deterministic Coin Tossing and k-Coloring CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

List Ranking and Ruling Set N/logN PEs Each PE has logN data Each PE has N/logN data 1. Find a 6 ruling set 2. Apply splice operation for ruling set Each iteration: c(N/logN) = top element be eliminated C(N/logN) k = N , k = O(logN) Complexity: O(logN* (log*N)logN) CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019

New Divide and Conquer Approach List-Ranking (A, m) 1. If m < n/logn, apply list ranking with each PE one node 2. Find Ruling Set 3. Reduce list to A’ 4. List-Ranking(A’, m’) Depth of recursion O(loglogN) Complexity logn * loglogN CSE838 Lecture notes copy right: Moon Jung Chung 5/16/2019