Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computing Connected Components on Parallel Computers

Similar presentations


Presentation on theme: "Computing Connected Components on Parallel Computers"— Presentation transcript:

1 Computing Connected Components on Parallel Computers
D.S. Hirschberg and A.K. Chandra Presented BY Baha’ Alsaify

2 Contributions This paper presents a way to compute the connected components in an undirected graph using n2 processors and with O(log2n) time complexity. This paper also shows that the same time complexity can be achieved if Processors are used. It also shows that the algorithm can be modified to compute a graph transitive closure with the same number of processors and with the same time complexity.

3 Definitions, Terminology and Assumptions
Connected Component: is a maximal subgraph of G (where G = (V,E)) such that there exist a path between every pair of vertices in the subgraph. A vertex belongs to exactly one connected component. Vector D: this is the identity vector. D(i) holds the identity of the connected component that i belongs to.

4 Definitions, Terminology and Assumptions (cont.)
D(i) is defined as the follows: if Gc=(Vc,Ec) is any connected component, then for all i Vc, D(i) equals the least element of Vc. Adjacency Matrix (A): is a nxn symmetric Boolean matrix where A(i,j) = 1 if (i,j) E. K-tree-Loop: is a directed graph in which each vertex has an out degree one (only one edge leaves each vertex), and in which there is exactly one cycle, and the length of that cycle is equal to k+1.

5 Example of a 2-tree-loop
The above graph shows a k-tree-loop with k = 2 Deleting any edge of the cycle will create a rooted tree with the root being the node with no edges leaving it. A k-tree-loop has k+1 edges in the cycle and at least k+1 elements Root

6 Definitions, Terminology and Assumptions (cont.)
C(i): defines the 1-tree-loop node i is part of. Clubs: a 0-tree-loop in which all the edges enter the root. In the CONNECT algorithm, the root of the tree will be the node with the minimum value (i.e. the connected component will be identified by the node with the minimal value in that connected component)

7 CONNECT Algorithm

8 Example 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) D(i)

9 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) D(i)

10 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) D(i) 1 2 3 4 5 6

11 Example (Cont.) 3 2 1 5 7 6 Step 1 will be executed once. All of the other steps will be executed for log(n) times 4 8 1 2 3 4 5 6 7 8 C(i) D(i) 1 2 3 4 5 6 7 8

12 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) D(i) 1 2 3 4 5 6

13 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 2 1 5 4 7 D(i) 3

14 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 2 1 5 4 7 D(i) 3

15 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 2 1 5 4 7 D(i) 3

16 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 2 1 5 4 7 D(i) 3

17 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 2 1 5 4 7 D(i)

18 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 2 1 5 4 7 D(i)

19 Example (Cont.) 3 2 1 5 7 6 4 First Iteration 8 1 2 3 4 5 6 7 8 C(i) 1
D(i) 7

20 Example (Cont.) 3 2 1 5 7 6 4 Second Iteration 8 1 2 3 4 5 6 7 8 C(i)

21 Example (Cont.) 3 2 1 5 7 6 4 Third Iteration 8 1 2 3 4 5 6 7 8 C(i) 1

22 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 1 2 4 5 D(i) 7

23 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 1 2 4 5 D(i)

24 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 1 2 4 5 D(i)

25 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 1 4 D(i)

26 Example (Cont.) 3 2 1 5 7 6 4 8 1 2 3 4 5 6 7 8 C(i) 1 4 D(i)

27 Example (Cont.) No matter how many iterations will follow, no change will happen on the graph since we have already defined the connected components in the graph.

28 Algorithm Explanation – First Iteration
During steps (2 & 3), the edges connecting each vertices are examined. During steps (4 – 6), the set of the vertices that are known to be connected are identified. After the end of each iteration, each set of vertices that are known to be connected are merged together into one Supervertices.

29 Algorithm Explanation – Next iteration
During steps (2&3), the connected supervertices are identified and during steps (4-6), these supervertices are merged together. The process continue until all the vertices in a connected component are joined together into one gigantic supervertices.

30 Theorems and Lemmas

31 LEMMA 1

32 LEMMA 1 - Explanation LEMMA 1 shows that C function will generate a set of 1-tree-loops. The paper proofs this LEMMA by a contradiction. To have a k-tree-loop, the paper defines a function C(Vi) = Vi+1 & C(Vk) = C(V0). V0 and V2 are neighbors for V1. C(V1) = V2, that contradict the definition of C in the LEMMA, and the only way for that to be true if we have a 1-tree-loops. So C defines a set of 1-tree-loops.

33 LEMMA 2

34 LEMMA 2 - Explanation To understand this LEMMA, we need to keep in mind that the output of the function C is a 1-tree-loop. CN(V) = C(CN-1(V)) & C1(V) = C(V).

35 Theorem 1

36 Theorem 1 - Proof If the graph is composed of a set of a disjoint vertices, then step 1 will define the connected components in that graph. After step 1, G(D) (a directed graph defined by D) satisfies the following: G(D) is a set of clubs. The root of each club is the smallest-numbered vertex in the club. The vertex set of any club is a subset of some connected component.

37 Theorem 1 – Proof (Cont.) After the execution of steps (2-6), G(D) will still satisfies properties (1&3). (That because C will only be working on vertices that have an edge between them (steps 2&3), and D will be computed based on C (steps 4&6)). In the next iterations the same thing will be done except that the algorithm will now deal with supervertices, where each vertex in the supervertex has the same value of D.

38 Theorem 1 – Proof (Cont.) The algorithm shows that each iteration decreases the number of supervertices by 2. That shows that the number of iteration required to identify the connected component will be equal to log(n).

39 Time and Processor Bounds
The main loop of the algorithm is executed in log(n) times, while the inner steps are also executed in log(n) times, so the final time bound of the algorithm is log2(n). The paper supposed that we are using n2 processors. Steps (1, 4 and 6) requires O(1) time bound. Step 5 requires log(n) time bound. Step(2&3) can also be programmed to run using O(log(n)) steps.

40 Time and Processor Bounds (Cont.)*
Since we have n2 processors, steps 2(a) & 2(c) can be done in O(1) time, and step 2(b) can be executed in O(log(n)) time. That means that step 2 can be executed in O(log(n)) time complexity.

41 Reducing the number of processors
Preparata and Probert found through extensive observations that the same time complexity can be achieved using processors. The main step behind achieving this is dividing the vertices into groups, where each group has log(n) elements. The idea behind the new algorithm is to compute the array Temp in O(log(n)) time. The algorithm works by first computing the smallest value of j in each one of the groups (requires O(log(n)) via sequential search). Then the smallest j in all the groups is computed. The time complexity for the previous operations is O(log(n) – log(log(n))).

42 Preparata and Probert Algorithm


Download ppt "Computing Connected Components on Parallel Computers"

Similar presentations


Ads by Google