Sei sulla pagina 1di 18

Euler Path

• An Eulerian path is a path


in which every edge is
used precisely once on a
connected graph
Euler Path
• An undirected graph has an Eulerian
path if and only if it is connected and
the number of vertices with odd-
degree is 2 or 0.

• Sequential Algorithm – Fleury’s


Algorithm

• Complexity: O ((V+E)2)
Euler Path
• Parallel Algorithm :

• Input – An undirected graph G with n vertices and


m edges specified as edge list.

• Stage 1: Determine whether or not a given graph


is an Eulerian path

• Stage 2: Divide each vertex into several new


vertices and find one Eulerian path
Euler Path
• The above algorithm works on a CREW-PRAM model

• It makes use of simple parallel algorithms to find the final


solution

• Stage 1 complexity: O(m) Processors and O(log m) Time


where m is the number of edges in the given undirected
graph

• Stage 2 complexity: O(log(n + m)) time and O(n + m)


processors
Euler Path
Euler Path
• Parallel Region:

• Stage 1:
• Merging 2 arrays of vertices which represent the
end vertices of the edges
• Parallel Sort algorithm to easily find degrees of each
vertex in the next step
• Computing boundary array to find degrees
• Parallel Prefix Sum algorithm on degree mod 2 array
to check if euler tour exists
Euler Path
• Parallel Region:

• Stage 2:
• Parallel Prefix Sum of array of degrees
• Finding new vertices and correspondence array
• Finding the new edges between new vertices
Minimum Spanning Tree
• In a weighted graph, a minimum spanning tree is a
spanning tree that has minimum weight than all
other spanning trees of the same graph.

• Sequential Algorithms: Krushkal’s , Prim’s,


Boruvka’s algorithm
Minimum Spanning Tree
• Sequential Boruvka’s Algorithm:
1) Input is a connected, weighted and directed graph.
2) Initialize all vertices as individual components (or
sets)
3) Initialize MST as empty.
4) While there are more than one components, do
following for each component. a) Find the closest
weight edge that connects this component to any
other component. b) Add this closest edge to MST if
not already added.
5) Return MST.
Minimum Spanning Tree
• Parallel Boruvka’s Algorithm:

• Step 1 (choose lightest): The edge list of each vertex is


searched to find the minimum weight edge from that
vertex.

• Step 2 (find root): Each vertex finds the root of the tree
to which it belongs using the well known pointer jumping
algorithm. The input R to the algorithm is the set of root
vertices, and the input S is the set of non-root vertices.
Minimum Spanning Tree
• Step 3 (rename vertices): Each processor finds the new
name of all vertices listed in its edge lists.

• Step 4 (merge): The edges of all vertices in a component


are sent to the processor that has the edge list of the
root. The edge lists are then merged by that processor.

• Step 5 (clean up): Each processor executes the sequential


algorithm on its own edge li
Minimum Spanning Tree
• Complexity of Sequential Algorithm: O(m log n)
where m is the number of edges and n is the
number of vertices.

• Theoretical Complexity of Parallel Algorithm:


O( t (m log n)/p) where
t is the transmission delay
p is the number of processors
n is the number of vertices
Minimum Spanning Tree
Minimum Spanning Tree
• Can we parallelize Prim’s and Krushkal’s algorithms?

• Which among the three is the most efficient when they


are parallelized?
Breadth First Search
• Complexity of sequential algorithm: O(n+m)
where n is the number of vertices and m is the
number of edges

• Complexity of parallel algorithm: O( (n+m) / p)

• Overhead of message passing


Breadth First Search
• Parallel regions:

• Each thread owns n/p vertices.


• Each thread searches for the next adjacent vertex.
• Synchronization is very essential to avoid multiple visits
to the same vertex
• Message regarding the locally visited vertices(within
each thread) should be communicated in each iteration
Implementation Details
• CUDA programming
• NVIDIA GeForce 920M with 384 shader cores divided
into two blocks of 192 each.
• GPU Clock: 954 MHz
• Memory Clock: 900 MHz
1800 MHz effective
Thank You

Potrebbero piacerti anche