parallel algorithm for mst

20
Fast shared-memory and Fast shared-memory and Parallel Algorithm for Parallel Algorithm for MST MST Prepared By: Prepared By: BHATT MITUL S. BHATT MITUL S. M.E. 1 M.E. 1 st st Year 1 Year 1 th th SEM SEM Roll No. 002 Roll No. 002 PEN :140450756002 PEN :140450756002 Guided By: Prof. Ghanshyam I. Prajapati Dept of CSE/IT

Upload: bhatt-mitul

Post on 17-Jan-2016

51 views

Category:

Documents


0 download

DESCRIPTION

Fast Shared memory and parallel algorithm for MST

TRANSCRIPT

Page 1: Parallel Algorithm for MST

Fast shared-memory and Fast shared-memory and Parallel Algorithm for MSTParallel Algorithm for MST

Prepared By: Prepared By:

BHATT MITUL S.BHATT MITUL S.

M.E. 1M.E. 1stst Year 1 Year 1thth SEM SEM

Roll No. 002Roll No. 002

PEN :140450756002PEN :140450756002

Guided By: Prof. Ghanshyam I. Prajapati Dept of CSE/IT

Page 2: Parallel Algorithm for MST

IntroductionIntroduction

The minimum spanning tree The minimum spanning tree problem (MST) for a weighted graph problem (MST) for a weighted graph is defined as follows: Given a directed is defined as follows: Given a directed connected graph connected graph G=(V,E,w)G=(V,E,w).V.V:Set of :Set of vertices, E:Set of edges and vertices, E:Set of edges and w=V×Vw=V×V→→RR: weight function. The : weight function. The minimum spanning tree problem is minimum spanning tree problem is to find a spanning tree with minimum to find a spanning tree with minimum total weight.total weight.

Page 3: Parallel Algorithm for MST

Introduction Conti..Introduction Conti..

The MST problem has applications The MST problem has applications in combinatorial problems with in combinatorial problems with practical applications in VLSI practical applications in VLSI layout, wireless communication, layout, wireless communication, medical imaging, chemical warfare, medical imaging, chemical warfare, graph steiner tree problem and many graph steiner tree problem and many other graph theoretical applicationsother graph theoretical applications

Page 4: Parallel Algorithm for MST

Parallel Algorithm for MSTParallel Algorithm for MST Parallel Algorithm for MST used flexible adjacency list Parallel Algorithm for MST used flexible adjacency list

data structure which is simpler than pointer jumping data structure which is simpler than pointer jumping algorithm of Boruvka’s algorithm. Boruvka’s algorithm algorithm of Boruvka’s algorithm. Boruvka’s algorithm has more parallel structure than Prim’s algorithm at the has more parallel structure than Prim’s algorithm at the cost of slower runtimes.cost of slower runtimes.

Thus there is a need to develop parallel MST Thus there is a need to develop parallel MST algorithms having intrinsic parallel structure like algorithms having intrinsic parallel structure like Boruvka’s algorithm and runtimes comparable with Boruvka’s algorithm and runtimes comparable with Prim’s algorithm. Prim’s algorithm.

Page 5: Parallel Algorithm for MST

Parallel Algorithm for MSTParallel Algorithm for MST New MST is proposed, which is faster than both Kruskal’s and New MST is proposed, which is faster than both Kruskal’s and

Boruvka’s algorithm but bit slower than Prim’s algorithm. Boruvka’s algorithm but bit slower than Prim’s algorithm. In short our contributions are as follows:In short our contributions are as follows:

Developed a new sequential algorithm for solving MST Developed a new sequential algorithm for solving MST problem of a graph.problem of a graph.

Parallelized the new algorithm in shared memory Parallelized the new algorithm in shared memory architecture.architecture.

Compared the Running Time (RT) of new sequential Compared the Running Time (RT) of new sequential algorithm with sequential Prim’s and Kruskal’s and algorithm with sequential Prim’s and Kruskal’s and Boruvka’s algorithms for both sparse and dense graphs. Boruvka’s algorithms for both sparse and dense graphs.

Page 6: Parallel Algorithm for MST

Boruvka’s AlgorithmBoruvka’s Algorithm Step 1 (Choose lightest): Each vertex selects the edge with the Step 1 (Choose lightest): Each vertex selects the edge with the

lightest weight incident on it. Each of the connected components thus lightest weight incident on it. Each of the connected components thus created has one cycle of size two between two vertices that each selects created has one cycle of size two between two vertices that each selects the same edge. Of this pain, the one with the smaller number is the same edge. Of this pain, the one with the smaller number is designated as the root of the component and the cycle is removed. The designated as the root of the component and the cycle is removed. The component is then a tree.component is then a tree.

Step 2 (Find root): Each vertex identifies the root of the tree to which it Step 2 (Find root): Each vertex identifies the root of the tree to which it belongs.belongs.

Step 3 (Rename vertices): In the edge lists, each vertex is renamed with Step 3 (Rename vertices): In the edge lists, each vertex is renamed with the name of the root of the component to which it belongs. the name of the root of the component to which it belongs.

Step 4 (Merge edge lists): Edge lists, which belong to the same Step 4 (Merge edge lists): Edge lists, which belong to the same component, are merged into the edge list of the root. In other words, each component, are merged into the edge list of the root. In other words, each connected component shrinks into a single vertex. connected component shrinks into a single vertex.

Step 5 (Clean up): Now the edge lists may have self loops and multiple Step 5 (Clean up): Now the edge lists may have self loops and multiple edges. All self loops are removed. Multiple edges are removed such edges. All self loops are removed. Multiple edges are removed such that only lightest edge remains between a pair of vertices.that only lightest edge remains between a pair of vertices.

Page 7: Parallel Algorithm for MST

Boruvka’s Algorithm Conti..Boruvka’s Algorithm Conti..

Total running time of Boruvka’s Total running time of Boruvka’s algorithm is algorithm is

Its parallel implementation in Its parallel implementation in shared memory with p processor is shared memory with p processor is given bygiven by

Page 8: Parallel Algorithm for MST

PROPOSED MINIMUM SPANNING TREE (MST)PROPOSED MINIMUM SPANNING TREE (MST)ALGORITHMALGORITHM

we present a new sequential algorithm for finding the we present a new sequential algorithm for finding the minimum spanning tree of a connected graph minimum spanning tree of a connected graph G=(V,E,w)G=(V,E,w)

Page 9: Parallel Algorithm for MST

ProofProof

Page 10: Parallel Algorithm for MST

Parallel Runtime Parallel Runtime

Thus the total complexity of the Thus the total complexity of the parallel algorithm PRT (P) is given byparallel algorithm PRT (P) is given by

Page 11: Parallel Algorithm for MST

ExampleExample

Step 1: At this step the light edges of vertices are selected. The selected edges are labelled with arrows. An edge with double arrows indicates this edge is chosen by both end vertices. Broken lines are the edge not selected in Step 1

After Step 1 we have two connected components C1,c2 and the following multi-graph. In the Figure 3 the connected components C1and C2are relabelled by super vertices V1sAnd V2s. We will stop applying further iterations ofBoruvka’s algorithm assuming the number of super vertices n0=2..

Page 12: Parallel Algorithm for MST

ExampleExample

Choosing minimum edge (V2,V4):cost = 5, connecting V1s to V2s. We have the following spanning tree T ‘ of super vertices V1s and V2s

Page 13: Parallel Algorithm for MST

ComparisonComparison

Page 14: Parallel Algorithm for MST

Fast shared-memory algorithms for Fast shared-memory algorithms for computing the minimum spanning forestcomputing the minimum spanning forest

of sparse graphsof sparse graphs

We provide an experimental study of our We provide an experimental study of our algorithms on symmetric multiprocessors algorithms on symmetric multiprocessors such as IBMs p Series and Sun’s such as IBMs p Series and Sun’s Enterprise servers. Enterprise servers.

Implementation achieves good speedups Implementation achieves good speedups over a wide range of input graphs with over a wide range of input graphs with regular and irregular structures, including regular and irregular structures, including the graphs used by previous parallel MST the graphs used by previous parallel MST studies.studies.

Page 15: Parallel Algorithm for MST

ComparisonComparison

Page 16: Parallel Algorithm for MST

Comparison conti..Comparison conti..

Page 17: Parallel Algorithm for MST

Comparison conti..Comparison conti..

Page 18: Parallel Algorithm for MST

ConclusionConclusion

This paper discusses a new algorithm for finding minimum This paper discusses a new algorithm for finding minimum

spanning tree of a weighted graph which is intrinsically spanning tree of a weighted graph which is intrinsically

parallel, unlike Kruskal’s algorithm. As far as the running time parallel, unlike Kruskal’s algorithm. As far as the running time

of the algorithm is concerned, it is faster than both Kruskal’s of the algorithm is concerned, it is faster than both Kruskal’s

and Boruvka’s algorithms. However the Prim’s algorithm is bit and Boruvka’s algorithms. However the Prim’s algorithm is bit

faster than ours algorithm. The parallel implementation of the faster than ours algorithm. The parallel implementation of the

proposed algorithm in shared memory is also better than proposed algorithm in shared memory is also better than

Boruvka’s parallel algorithmBoruvka’s parallel algorithm

Page 19: Parallel Algorithm for MST

Literature ReviewLiterature ReviewSr. No

Name of Journal Author and Year Publication

1 A New Parallel Algorithm for Minimum Spanning Tree(MST)

Alok Ranjan Tripathy, B. N. B. Ray,[2013]

This paper discusses a new algorithm for finding minimum spanning tree of a weighted graph which is intrinsically parallel, unlike Kruskal’s algorithm. As far as the running time of the algorithm is concerned, it is faster than both Kruskal’s and Boruvka’s algorithms. However the Prim’s algorithm is bit faster than ours algorithm.

2 Fast shared-memory algorithms for computing the minimum spanning forestof sparse graphs

David A. Bader, Guojing Cong,[2006]

This present a new non-deterministic MST algorithm that uses a load-balancing scheme based upon work stealing that, unlike Boruvka variants, gives reasonable speedup when compared with the best sequential algorithms on several structured inputs that are hard to achieve parallel speedup

Page 20: Parallel Algorithm for MST

T h a n k Y o uT h a n k Y o u