Download presentation

1
**Sorting an Intransitive Total Ordered Set**

Sequential and Parallel Implementation for COMP 5704 Parallel Algorithms by Johannes Singler, Carleton University

2
**Presentation Outline Introduction to the Problem Prerequisites**

Sequential Algorithm Parallelizing for a PRAM Questions?!

3
**Introduction Definition of Transitivity:**

Traditional sorting relies upon (Transitive) Total Ordered Set (e. g. natural numbers and ≥). New Problem: Sorting of Intransitive Total Ordered Set (ITOS) Relying on intransitive relation

4
**Intransitive Sorted Sequence**

An intransitive sorted sequence has to satisfy: Theorem: There exists always a solution (proof later if time remaining). The solution is not unique in general. Real-world example for an ITOS: tournament in sports: Every player wins or loses against each other. Therefore ITOS also referred to as a Tournament.

5
**Representation as a Graph**

Tournament can be represented as a complete directed graph. Every two nodes are connected by an edge, direction denotes relation (who wins). A intransitive sorted sequence then corresponds to a Hamiltonian Path. Definition of Hamiltonian Path: A path in a graph that visits every node exactly once.

6
**Sorting Prerequisites**

Sorting using Semi-Heap according to Wu [2] Definition of On 3 elements. Set in general (not unique any more). If one player beats both the others, he is the only maximum element, otherwise all three are maximal. Definition of a Semi-Heap Binary tree (complete in the beginning). Similar to a heap. Semi-Heap condition: 4 valid possibilities (and 4 invalid):

7
**Actual Sorting Similar to Heap-Sort**

Build up heap Iteratively remove root, replace by rightmost leaf of deepest level before pushing this down the heap. Intransitive Sorting using Semi-Heap Build up semi-heap Iteratively remove root, update semi-heap top-down. Tree may not be complete any more after first removal.

8
**Pseudo-Code Pseudo-Code:**

semi-heap-sort build-semi-heap While nodes left Remove root and append to sorted sequence Recursively replace by winning child top-down build-semi-heap (Q(n)) for i:=heapsize/2 downto 1 semi-heapify(i) semi-heapify(i) if(i not max) exchange with max child semi-heapify(former child position) recursively

9
**Sequential Complexity**

Demo Sequential Complexity: O(n log n)

10
**Parallelizing the Algorithm for a PRAM**

Parallelizing for fine-grained multiprocessing using Pipelining. One processor per two consecutive tree levels (overlapping): Q(log n) processors needed. Two phases: Either processors with even numbers or processor with odd numbers are active. While updating the tree top-down, the work is handed from one processor to the next. Demo

11
**Complexity Issues Parallel Complexity:**

Q(n) on an EREW PRAM using Q(log n) processors, therefore cost-optimal. Building the initial semi-heap takes Q(n) sequentially and thus needs no parallelization. No concurrent access needed because of phases. Can be modified to use less processors according to Brent’s Law.

12
Outlook Extension: A Hamiltonian Cycle exists in every strong connected Tournament. Definition of strong connected: Every node is reachable from each other Hamiltonian Cycle: Every node is visited exactly once and there is an edge from the last node to the first one:

13
Questions? Do you have any questions left?

14
Questions! Which of the following subtrees satisfy the semi-heap condition? What does Pipelining mean? How many possible tournaments of size n are there?

15
Conclusion Presentation and demo program available at my website: References [1] Danny Soroker. Fast parallel algorithms for finding Hamiltonian paths and cycles in a tournament. Journal of Algorithms, 9(2):276–286, June [2] J. Wu. On sorting an intransitive total ordered set using semi-heap. In International Parallel and Distributed Processing Symposium, pages 257–262, 2000.

16
**Appendix: Proof of Theorem**

By induction according to Soroker [1] Result clear for n=2 n → n+1 Let v be vertex of V(T), then V(T)-{v} has Hamiltonian Path v1,…,vn If v → v1, then v,v1,…,vn is a valid result Otherwise let I be the largest index such that vi → v, then v1,…,vi,v,vi+1,…,vn or v1,…,vn,v respectively (i=n) is a valid result.

Similar presentations

Presentation is loading. Please wait....

OK

Parallel Architectures: Topologies Heiko Schröder, 2003.

Parallel Architectures: Topologies Heiko Schröder, 2003.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google