Presentation is loading. Please wait.

Presentation is loading. Please wait.

On the Graph Decomposition

Similar presentations


Presentation on theme: "On the Graph Decomposition"— Presentation transcript:

1 On the Graph Decomposition
Yangjun Chen and Yibin Chen Dept. Applied Computer Science, University of Winnipeg 515 Portage Ave. Winnipeg, Manitoba, Canada R3B 2E9

2 Outline Motivation Graph stratification Main algorithm
- Bipartite graphs and virtual nodes - Chain generation - Resolving virtual nodes Summary

3 Motivation Graph decomposition into node-disjoint chains
Given a directed acyclic graph G, decompose it into a minimum set of node-disjoint chains, which cover all the nodes of G. For any two nodes u and v on a chain, if u is above v then there is a path from u to v in G. Application - Decomposition of a partially ordered sets (posets) into a minimum set of chains - Compress transitive closures of graphs

4 Motivation a1 a2 a1 a2 a1 a2 a3 a3 a3 a4 a4 a4 a5 a6 a5 a6 a5 a6

5 Motivation Compression of transitive closures O(n2) O(n)
index Index sequence 1 2 a3 (1, 1) a1 (2, 1) a2 (1, 1)(2, 2) (1, 2)(2, 1) a4 (1, 1) a3 (2, 2) a4 (1, 2)(2, 2) (1, 3)(2, 2) a5 a6 (1, 3) a5 a6 (2, 3) (1, 3) (2, 3) O(n2) O(n)  - number of chains

6 Main idea of graph decomposition
Stratifying a graph into a series of bipartite graphs: G1, …, Gh. Finding a maximum matching Mi for each Gi. (In this process, virtual nodes may be introduced.) Combining all Mi’s to get a set of chains, denoted as M1  …  Gh, which may contain virtual nodes. Removing the virtual nodes to get the final result.

7 Graph stratification Definition 1 Let G(V, E) be a DAG. We decompose V into subsets V0, V1, ..., Vh such that V = V0  V1  ...  Vh and each node in Vi has its children appearing only in Vi-1, ..., V0 (i = 1, ..., h), where h is the height of G, i.e., the length of the longest path in G.  q r s V4: q r s n o p m V3: n o p m j k l t i V2: j k l t i g h f x V1: g x h f b y c d e z a b V0: y c d e z a

8 Graph stratification Dividing a graph into
a series of bipartite graphs: V4: q r s V3: n o p m V3: n o p m e a b y d f g h i j k l m n o p q r s t z x c V2: j k l t i V2: j k l t i V1: g x h f V1: g f x h V0: b y c d e z a

9 Virtual nodes Find a maximum matching for each bipartite graph
and then combine them together, by which ‘virtual node’ may be introduced. Definition 2 (virtual nodes) Let G(V, E) be a DAG, divided into V0, ..., Vh (i.e., V = V0  ...  Vh). Let Mi be a maximal matching of B(Vi, Vi-1′; Ci) for i = 1, …, h. For each free node v in Vi-1′ with respect to Mi, a virtual node v′ created for v is a new node added to Vi (1  i  h - 1), denoted as v = s(v′). 

10 Virtual Nodes Definition 2 (virtual nodes) Let G(V, E) be a DAG, divided into V0, ..., Vh (i.e., V = V0  ...  Vh). Let Mi be a maximal matching of B(Vi, Vi-1′; Ci) for i = 1, …, h. For each free node v in Vi-1′ with respect to Mi, a virtual node v′ created for v is a new node added to Vi (1  i  h - 1), denoted as v = s(v′).  q r s V1: V0: e a b y d g h z x c V4: V3: n o p m V2: j k l t i M1: g x h V1’: g x c’ h e’ z’ f b y c d e z a label(t  e’) = 0 label(j  e’) = 1 label(t  z’) = 0 label(k  c’) = 1 label(i  e’) = 0 label(k  e’) = 1 label(i  z’) = 0 label(l  c’) = 1 label(j  c’) = 1 label(l  e’) = 1

11 Virtual Arcs inherited arcs - If there is u  Vj (j > i) such that u  v  E, add u  v′, referred to as an inherited arc. transitive arcs - If there exist u  Vj (j > i) and w  Vi such that u  w  E and w  v  Ci, add u  v′ if it has not been created as an inherited arc, referred to as a transitive arc. alternating arcs of the first kind - If there exists a covered node w  Vi-1′ (relative to Mi) such that one of v’s parents is connected to w through an -segment in B(Vi, Vi-1′; Ci), and u  Vj (j > i) such that one of the two conditions holds: u  w  E, or there is a node w′  Vi such that u  w′  E and w′  w  Ci, add u  v′ if it has not been created as an inherited or a transitive arc.

12 Chain Generation V1: V0: e a b y d g h z x c f g h i j k l t c’ e’ z’
M1: e a b y d g h z x c M2: j k l t i g x c’ h e’ z’ f q r s V4: q r s M3: m n o p i j k l t M4: V3: n o p m o p V2: j k l t i V1’: g x c’ h e’ z’ f

13 Chain Generation q r s M4: o p q r s M3: m n o p i j k l t n o p m M2:
x c’ h e’ z’ f g x c’ h e’ z’ f M1: e a b y d g h z x c b y c d e z a

14 Chain Generation m n o p q r s f g h i j k l t x a y c d e z b q r s n

15 Chain Generation m n o p q r s f g h i j k l t x a y c d e z b q r s n

16 Chain Generation = V( ) = T  S, and
Definition 3 (alternating graph) Let B(T, S; E) be a bipartite graph. Let M be a matching of B(T, S; E). The alternating graph with respect to M is a directed graph with the following sets of nodes and arcs: = V( ) = T  S, and = E( ) = {u  v | u  S, v  T, and (u, v)  M}  {v  u | u  S, v  T, and (u, v)  E\M}.  V1: g x h V1: g x h V0: V0: b y c d e z a b y c d e z a M1: g x h b y c d e z a

17 Chain Generation Next, we will combine two consecutive alternating graphs = (Vi′, Vi-1′; Ci) and = (Vi+1, Vi′; Ci+1), denoted as  , by connecting each node in Vi+1 to all its reachable nodes in Vi-1′. j k l t i V2: V1: g x h f g x h f V1: V0: b y c d e z a

18 Chain Generation f g h i j k l t x e a y c d z b j k l t i V2: V1: g x
A maximum set of node disjoint paths with each starting from a free node u relative to Mi+1 in Vi+1, and ending at a free node v relative to Mi in Vi-1′,

19 Chain Generation What we want is to find a maximum set S of node-disjoint paths in  , each starting from a free node u relative to Mi+1 in Vi+1, and ending at a free node v relative to Mi in Vi-1′. Let P be such a path with u and v being the starting and ending nodes. We will create a virtual node v´ for v, connect it u. However, for each free node (in Vi-1′) not appearing on such a path, its virtual node will be added to Vi+1, for which only inherited and transitive arcs, as well as a new kind of virtual arcs, called alternating arcs of the second kind will be created.

20 Chain Generation Alternating arc of the second kind – Let v´ be a virtual node Created for v in Vi-1′ and added to Vi+1. If there exist a free node w  Vi-1′ (relative to Mi) and a node u  Vj (j > i) such that one of v’s parents is connected to w through a -segment in B(Vi′, Vi-1′; Ci), satisfying one of the following two conditions: - u  w  E, or there is an alternating path in (Vi′, Vi-1′; Ci), which does not go through any node in S, but connects w to a node x  Vi-1′ such that x is reachable from u, add u  v′ if it has not been created as an inherited or a transitive arc. label(u  v′) is set to be i, same as an alternating arc incident to a virtual node added to Vi′.

21 Chain Generation M2: j k c′ l t i q r s V1: V0: V4: V2: V3: e a b y d
z c f g h x c′ z′ m n o p i j k l t e′ c′′ g x h e′ z′ f n o p m M3: j k c′ l t i n o p m g x h e′ z′ f j k c′ l t i b y c d e z a M4: q r s label(l  e’) = 1 label(m  c’) = 1 label(t  z) = 0 label(q  c’) = 1 label(q  c) = 1 n o p m

22 Chain Generation q r s e a b y d q r s z c f g h x c′ z′ m n o p i j k
l t e′ c′′ q r s V4: n o c′′ p m n o c′′ V3: p m j k c′ l t i q r s g h M4: x e′ z′ f n o c′′ p m b y c d e z a

23 Virtual Node Resolution
After the chain generation, the next step is to resolve (or say, to remove) virtual nodes from chains. For this purpose, we will work top-down along the chains. Two steps will be carried out: Remove virtual nodes, and at the same time connect some nodes according to the connectivity represented by them, and Establish new connections between free nodes by transferring edges along alternating paths within a bipartite graph or cross more than one bipartite graph.

24 Virtual Node Resolution
When we try to remove virtual nodes v with label(u  v) = i, all the virtual nodes with higher labels must have been eliminated. In this step, the following operations will be conducted. Let v be a virtual node in Vi′. If v does not have a parent along the corresponding chain, it will be simply removed. If v has a parent u along a chain with label(u  v) = 0, remove v and connect u to s(v). label(u  s(v)) is set to 0. Let level(s(v)) = i. Connect u to each reachable node in Vi.

25 Virtual Node Resolution
If v has a parent u along a chain with label(u  v) = i, remove v and connect u to each reachable node in Vi-1. Construct a combined graph in a way similar to the chain generation, involving the corresponding bipartite graphs, where the direction of each arc corresponding to an edge belonging to a maximum matching is reversed.

26 Virtual Node Resolution
q r s q r s n o p m n o p m j k l t i j k l t i g x h g x h z′ f e′ f b y c d e z a b y c d e z a

27 Virtual Node Resolution
q r s q r s n o p m n o p m j k l t i j k l t i j k l t i g x h f g x h f b y c d e z a g x h f b y c d e z a

28 Virtual Node Resolution
q r s q r s n o c′′ p m n o p m j k c′ l t i j k l t i g x h e′ z′ g h f x f b y c d e z a b y c d e z a

29 Summary A efficient algorithm for graph decomposition
- Graph stratification - Algorithm for finding maximum matching for bipartite graphs - Virtual nodes Computational complexities time: O(max{ n, m}) space overhead: O(n)

30 Thanks you.


Download ppt "On the Graph Decomposition"

Similar presentations


Ads by Google