1 Parallel Algorithms III Topics: graph and sort algorithms.

Slides:



Advertisements
Similar presentations
Lecture 15. Graph Algorithms
Advertisements

Algorithms (and Datastructures) Lecture 3 MAS 714 part 2 Hartmut Klauck.
Graph Algorithms Carl Tropper Department of Computer Science McGill University.
Lecture 19: Parallel Algorithms
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
1 Discrete Structures & Algorithms Graphs and Trees: III EECE 320.
Topological Sort Topological sort is the list of vertices in the reverse order of their finishing times (post-order) of the depth-first search. Topological.
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
Chapter 8, Part I Graph Algorithms.
 Graph Graph  Types of Graphs Types of Graphs  Data Structures to Store Graphs Data Structures to Store Graphs  Graph Definitions Graph Definitions.
Combinatorial Algorithms
1 Parallel Algorithms II Topics: matrix and graph algorithms.
ITEC200 – Week 12 Graphs. 2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study.
1 Discrete Structures & Algorithms Graphs and Trees: II EECE 320.
Graph Algorithms: Minimum Spanning Tree We are given a weighted, undirected graph G = (V, E), with weight function w:
1 Lecture 25: Parallel Algorithms II Topics: matrix, graph, and sort algorithms Tuesday presentations:  Each group: 10 minutes  Describe the problem,
Lecture 21: Parallel Algorithms
Introduction to Graphs
A general approximation technique for constrained forest problems Michael X. Goemans & David P. Williamson Presented by: Yonatan Elhanani & Yuval Cohen.
Introduction to Graphs What is a Graph? Some Example applications of Graphs. Graph Terminologies. Representation of Graphs. –Adjacency Matrix. –Adjacency.
Greedy Algorithms Reading Material: Chapter 8 (Except Section 8.5)
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Shortest Path Problems Directed weighted graph. Path length is sum of weights of edges on path. The vertex at which the path begins is the source vertex.
Chapter 9 Graph algorithms Lec 21 Dec 1, Sample Graph Problems Path problems. Connectedness problems. Spanning tree problems.
Aho-Corasick String Matching An Efficient String Matching.
Algorithms All pairs shortest path
1 Lecture 24: Parallel Algorithms I Topics: sort and matrix algorithms.
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
Greedy Algorithms Like dynamic programming algorithms, greedy algorithms are usually designed to solve optimization problems Unlike dynamic programming.
Graphs & Graph Algorithms 2 Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Parallel Algorithms IV Topics: image analysis algorithms.
Data Structures Using C++ 2E
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Lecture 12-2: Introduction to Computer Algorithms beyond Search & Sort.
1 Lecture 21: Core Design, Parallel Algorithms Today: ARM Cortex A-15, power, sort and matrix algorithms.
Chapter 2 Graph Algorithms.
Graph Theory Topics to be covered:
CALTECH CS137 Winter DeHon 1 CS137: Electronic Design Automation Day 12: February 6, 2006 Sorting.
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.
Graph Algorithms Ananth Grama, Anshul Gupta, George Karypis, and Vipin Kumar Adapted for 3030 To accompany the text ``Introduction to Parallel Computing'',
Shortest Paths CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
Winter 2014Parallel Processing, Fundamental ConceptsSlide 1 2 A Taste of Parallel Algorithms Learn about the nature of parallel algorithms and complexity:
Graphs. Graphs Similar to the graphs you’ve known since the 5 th grade: line graphs, bar graphs, etc., but more general. Those mathematical graphs are.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Graphs Upon completion you will be able to:
Graph Theory. undirected graph node: a, b, c, d, e, f edge: (a, b), (a, c), (b, c), (b, e), (c, d), (c, f), (d, e), (d, f), (e, f) subgraph.
CSE 421 Algorithms Richard Anderson Winter 2009 Lecture 5.
+ Even Odd Sort & Even-Odd Merge Sort Wolfie Herwald Pengfei Wang Rachel Celestine.
Unit-8 Sorting Algorithms Prepared By:-H.M.PATEL.
1 Closures of Relations Based on Aaron Bloomfield Modified by Longin Jan Latecki Rosen, Section 8.4.
All Pairs Shortest Path Algorithms Aditya Sehgal Amlan Bhattacharya.
Introduction to Graphs
Minimum Spanning Tree Chapter 13.6.
Minimum Spanning Trees
Computing Connected Components on Parallel Computers
Introduction to Graphs
Lecture 16: Parallel Algorithms I
Lecture 22: Parallel Algorithms
Lecture 7 All-Pairs Shortest Paths
Graphs & Graph Algorithms 2
Floyd’s Algorithm (shortest-path problem)
All pairs shortest path problem
Lecture 14 Shortest Path (cont’d) Minimum Spanning Tree
Text Book: Introduction to algorithms By C L R S
Richard Anderson Lecture 5 Graph Theory
Closures of Relations Epp, section 10.1,10.2 CS 202.
Lecture 13 Shortest Path (cont’d) Minimum Spanning Tree
Introduction to Graphs
Introduction to Graphs
Presentation transcript:

1 Parallel Algorithms III Topics: graph and sort algorithms

2 Graph Algorithms

3 Floyd Warshall Algorithm

4 Implementation on 2d Processor Array Row 3 Row 2 Row 1 Row 3 Row 2 Row 1/2 Row 3 Row 1/3 Row 2 Row 1 Row 2/3 Row 2/1 Row 3 Row 2 Row 3/1Row 3/2 Row 1 Row 3 Row 2 Row 1 Row 3 Row 2 Row 1

5 Algorithm Implementation Diagonal elements of the processor array can broadcast to the entire row in one time step (if this assumption is not made, inputs will have to be staggered) A row sifts down until it finds an empty row – it sifts down again after all other rows have passed over it When a row passes over the 1 st row, the value of a i1 is broadcast to the entire row – a ij is set to 1 if a i1 = a 1j = 1 – in other words, the row is now the i th row of A (1) By the time the k th row finds its empty slot, it has already become the k th row of A (k-1)

6 When the i th row starts moving again, it travels over rows a k (k > i) and gets updated depending on whether there is a path from i to j via vertices < k (and including k) Algorithm Implementation

7 Shortest Paths Given a graph and edges with weights, compute the weight of the shortest path between pairs of vertices Can the transitive closure algorithm be applied here?

8 Shortest Paths Algorithm The above equation is very similar to that in transitive closure

9 Minimum Weight Spanning Tree Given an undirected connected graph and edges with weights, compute the spanning tree with minimum sum of weights The following theorem simplifies the algorithm design:

10 Example

11 Theorem Proof

12 Parallel Algorithm Implementation Employ shortest-paths algorithm again – the weight of a path is now the heaviest edge on the path

13 Sorting with Comparison Exchange Earlier sort implementations assumed processors that could compare inputs and local storage, and generate an output in a single time step The next algorithm assumes comparison-exchange processors: two neighboring processors I and J (I < J) show their numbers to each other and I keeps the smaller number and J the larger

14 Odd-Even Sort N numbers can be sorted on an N-cell linear array in O(N) time: the processors alternate operations with their neighbors

15 The 0-1 Sorting Lemma If a comparison-exchange algorithm sorts input sets consisting solely of 0’s and 1’s, then it sorts all input sets of arbitrary values

16 Shearsort A sorting algorithm on an N-cell square matrix that improves execution time to O(sqrt(N) logN) Algorithm steps: Odd phase: sort each row with odd-even sort (all odd rows are sorted left to right and all even rows are sorted right to left) Even phase: sort each column with odd-even sort Repeat Each odd and even phase takes O(sqrt(N)) steps – the input is guaranteed to be sorted in O(logN) steps

17 Example

18 Complexity Proof How do we prove that the algorithm completes in O(logN) phases? (each phase takes O(sqrt(N)) steps) Assume input set of 0s and 1s There are three types of rows: all 0s, all 1s, and mixed entries – we will show that after every phase, the number of mixed entry rows reduces by half The column sort phase is broken into the smaller steps below: move 0 rows to the top and 1 rows to the bottom; the mixed rows are paired up and sorted within pairs; repeat these small steps until the column is sorted

19 Example The modified algorithm will behave as shown below: white depicts 0s and blue depicts 1s

20 Proof If there are N mixed rows, we are guaranteed to have fewer than N/2 mixed rows after the first step of the column sort (subsequent steps of the column sort may not produce fewer mixed rows as the rows are not sorted) Each pair of mixed rows produces at least one pure row when sorted

21 Title Bullet