Transitive Closure Compression Jan. 2013Yangjun Chen ACS-71021 Outline: Transitive Closure Compression Motivation DAG decomposition into node-disjoint.

Slides:



Advertisements
Similar presentations
Longest Common Subsequence
Advertisements

2012: J Paul GibsonT&MSP: Mathematical FoundationsMAT7003/L2-GraphsAndTrees.1 MAT 7003 : Mathematical Foundations (for Software Engineering) J Paul Gibson,
Divide and Conquer. Subject Series-Parallel Digraphs Planarity testing.
Greedy Algorithms Greed is good. (Some of the time)
1/44 A simple Test For the Consecutive Ones Property.
Global Flow Optimization (GFO) in Automatic Logic Design “ TCAD91 ” by C. Leonard Berman & Louise H. Trevillyan CAD Group Meeting Prepared by Ray Cheung.
Parallel Scheduling of Complex DAGs under Uncertainty Grzegorz Malewicz.
Lectures on Network Flows
1.2 Row Reduction and Echelon Forms
Jan. 2013Dr. Yangjun Chen ACS Outline Signature Files - Signature for attribute values - Signature for records - Searching a signature file Signature.
Yangjun Chen 1 Bipartite Graphs What is a bipartite graph? Properties of bipartite graphs Matching and maximum matching - alternative paths - augmenting.
Implementation of Graph Decomposition and Recursive Closures Graph Decomposition and Recursive Closures was published in 2003 by Professor Chen. The project.
An Efficient Algorithm for Answering Graph Reachability Queries Yangjun Chen, Yibin Chen Dept. Applied Computer Science, University of Winnipeg 515 Portage.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Connected Components, Directed Graphs, Topological Sort COMP171.
Introduction to Graphs
Yangjun Chen 1 Bipartite Graph 1.A graph G is bipartite if the node set V can be partitioned into two sets V 1 and V 2 in such a way that no nodes from.
Reachability Queries Sept. 2014Yangjun Chen ACS Outline: Reachability Query Evaluation What is reachability query? Reachability query evaluation.
Recursive Graph Deduction and Reachability Queries Yangjun Chen Dept. Applied Computer Science, University of Winnipeg 515 Portage Ave. Winnipeg, Manitoba,
Chapter 12 Trees. Copyright © 2005 Pearson Addison-Wesley. All rights reserved Chapter Objectives Define trees as data structures Define the terms.
Maximal Independent Set Distributed Algorithms for Multi-Agent Networks Instructor: K. Sinan YILDIRIM.
1 Efficient Discovery of Conserved Patterns Using a Pattern Graph Inge Jonassen Pattern Discovery Arwa Zabian 13/07/2015.
Important Problem Types and Fundamental Data Structures
Circle Graph and Circular Arc Graph Recognition. 2/41 Outlines Circle Graph Recognition Circular-Arc Graph Recognition.
9.2 Graph Terminology and Special Types Graphs
Space-Efficient Sequence Alignment Space-Efficient Sequence Alignment Bioinformatics 202 University of California, San Diego Lecture Notes No. 7 Dr. Pavel.
Zvi Kohavi and Niraj K. Jha 1 Capabilities, Minimization, and Transformation of Sequential Machines.
Advanced Algorithms Analysis and Design Lecture 8 (Continue Lecture 7…..) Elementry Data Structures By Engr Huma Ayub Vine.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
UNC Chapel Hill M. C. Lin Point Location Reading: Chapter 6 of the Textbook Driving Applications –Knowing Where You Are in GIS Related Applications –Triangulation.
Chapter 2 Graph Algorithms.
GRAPHS CSE, POSTECH. Chapter 16 covers the following topics Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component,
Introduction Of Tree. Introduction A tree is a non-linear data structure in which items are arranged in sequence. It is used to represent hierarchical.
UNC Chapel Hill Lin/Foskey/Manocha Minimum Spanning Trees Problem: Connect a set of nodes by a network of minimal total length Some applications: –Communication.
Union-find Algorithm Presented by Michael Cassarino.
Data Structures & Algorithms Graphs
10. Lecture WS 2006/07Bioinformatics III1 V10: Network Flows V10 follows closely chapter 12.1 in on „Flows and Cuts in Networks and Chapter 12.2 on “Solving.
Agenda Review: –Planar Graphs Lecture Content:  Concepts of Trees  Spanning Trees  Binary Trees Exercise.
Chapter 10 Graph Theory Eulerian Cycle and the property of graph theory 10.3 The important property of graph theory and its representation 10.4.
Network Flows Chun-Ta, Yu Graduate Institute Information Management Dept. National Taiwan University.
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
Chapter 8: Relations. 8.1 Relations and Their Properties Binary relations: Let A and B be any two sets. A binary relation R from A to B, written R : A.
A New Top-down Algorithm for Tree Inclusion Dr. Yangjun Chen Dept. Applied Computer Science, University of Winnipeg 515 Portage Ave. Winnipeg, Manitoba,
Heaps © 2010 Goodrich, Tamassia. Heaps2 Priority Queue ADT  A priority queue (PQ) stores a collection of entries  Typically, an entry is a.
2IS80 Fundamentals of Informatics Fall 2015 Lecture 7: Sorting and Directed Graphs.
Finding Regular Simple Paths Sept. 2013Yangjun Chen ACS Finding Regular Simple Paths in Graph Databases Basic definitions Regular paths Regular simple.
12. Lecture WS 2012/13Bioinformatics III1 V12 Menger’s theorem Borrowing terminology from operations research consider certain primal-dual pairs of optimization.
Introduction to NP Instructor: Neelima Gupta 1.
Iterative Improvement for Domain-Specific Problems Lecturer: Jing Liu Homepage:
Data Structures and Algorithm Analysis Graph Algorithms Lecturer: Jing Liu Homepage:
1 1.2 Linear Equations in Linear Algebra Row Reduction and Echelon Forms © 2016 Pearson Education, Ltd.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
Capabilities, Minimization, and Transformation of Sequential Machines
Directed Graphs 12/7/2017 7:15 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
GRAPHS Lecture 16 CS2110 Fall 2017.
Bipartite Graphs What is a bipartite graph?
Heaps © 2010 Goodrich, Tamassia Heaps Heaps
Lectures on Network Flows
Directed Graphs 9/20/2018 1:45 AM Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia,
Depth-First Search.
Outline: Transitive Closure Compression
Graphs All tree structures are hierarchical. This means that each node can only have one parent node. Trees can be used to store data which has a definite.
Directed Graphs Directed Graphs Directed Graphs 2/23/ :12 AM BOS
Bipartite Graph 1. A graph G is bipartite if the node set V can be partitioned into two sets V1 and V2 in such a way that no nodes from the same set are.
Algorithms (2IL15) – Lecture 7
On the Graph Decomposition
GRAPHS Lecture 17 CS2110 Spring 2018.
Important Problem Types and Fundamental Data Structures
Heaps & Multi-way Search Trees
Concepts of Computation
Presentation transcript:

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Outline: Transitive Closure Compression Motivation DAG decomposition into node-disjoint chains -Graph stratification -Virtual nodes -Maximum set of node-disjoint paths

Transitive Closure Compression Jan. 2013Yangjun Chen ACS A simple method - store a transitive closure as a matrix Motivation c b a d e G:G: c b a d e G*: M = abcdeabcde abcdeabcde M* = abcdeabcde abcdeabcde Space overhead: O(n 2 ) Query time: O(1)

Transitive Closure Compression Jan. 2013Yangjun Chen ACS DAG Decomposition into Node-Disjoint Chains A DAG is a directed acyclic graph (a graph containing no cycles). On a chain, if node v appears above node u, there is a path from v to u in G. g h i b c d a f e A DAG is a directed acyclic graph (a graph containing no cycles). On a chain, if node v appears above node u, there is a path from v to u in G. a f b c d e g h i a f

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Decomposition of a DAG into a set of node-disjoint chains a f b c d e g h i a f a c e f b d g h i

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Based on such a chain decomposition, we can assign each node an index as follows: (1)Number each chain and number each node on a chain. (2)The jth node on the ith chain will be assigned a pair (i, j) as its index. a c e f b d g h i (2, 1) (2, 2) (2, 3) (1, 1) (1, 2) (1, 3) (3, 1) (3, 2) (3, 3)

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Each node v on the ith chain will also be associated with an index sequence of length k : (1, j 1 ) … (i – 1, j i-1 ) (i + 1, j i+1 ) … (k, j k ) such that any node with index (x, y) is a descendant of v if x = i and y < j or x  i but y  j x, where k is the number of the disjoint chains. a c e f b d g h i (2, 1) (2, 2) (2, 3) (1, 1) (1, 2) (1, 3) (3, 1) (3, 2) (3, 3) (2, 2)(3, 3) (2, 3)(3, _) (2, _)(3, _) (1, 2)(3, 3) (1, 3)(3, 3) (1, _)(3, _) (1, _)(2, 3) (1, 3)(2, _) (1, _)(2, _) The space complexity is bounded by O(kn).

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Construction of Index Sequences Each leaf node is exactly associated with one index, which is trivially sorted. Let v 1,..., v l be the child nodes of v, associated with the index sequences L 1,..., L l, respectively. Assume that |L i |  b (1  i  l) and the indexes in each L i are sorted according to the first element in each index. We will merge all L i ’s into a new index sequence and associate it with v. This can be done as follows. First, make a copy of L 1, denoted L. Then, we merge L 2 into L by scanning both of them from left to right. Let (a 1, b 1 ) (from L) and (a 2, b 2 ) (from L 2 ) be the index pair encountered. We will do the following checkings:

Transitive Closure Compression Jan. 2013Yangjun Chen ACS If a 2 > a 1, we go to the index next to (a 1, b 1 ) and compare it with (a 2, b 2 ) in a next step. - If a 1 > a 2, insert (a 2, b 2 ) just before (a 1, b 1 ). Go to the index next to (a 2, b 2 ) and compare it with (a 1, b 1 ) in a next step. - If a 1 = a 2, we will compare b 1 and b 2. If b 1 > b 2, nothing will be done. If b 2 > b 1, replace b 1 with b 2. In both cases, we will go to the indexes next to (a 1, b 1 ) and (a 2, b 2 ), respectively. We will repeatedly merge L 2,..., L l into L. Obviously, |L|  b and the indexes in L are sorted. The time spent on this process is O(d v k), where d v represents the outdegree of v. So the whole cost is bounded by O( d v k) = O(ke), where e is the number of edges of G.  v

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Graph Stratification Definition (DAG stratification) Let G(V, E) be a DAG. The stratifi- cation of G is a decomposition of V into subsets V 1, V 2,..., V h such that V = V 1  V 2 ... V h and each node in V i has its children appearing only in V i-1,..., V 1 (i = 2,..., h), where h is the height of G, i.e., the length of the longest path in G. For each node v in V i, its level is said to be i, denoted l(v) = i. In addition, C j (v) (j < i) represents a set of links with each pointing to one of v’s children, which appears in V j. Therefore, for each v in V i, there exist i 1,..., i k (i l < i, l = 1,..., k) such that the set of its children equals (v) ...  (v). Assume that V i = {v 1, v 2,..., v k }. We use (j < i) to represent C j (v 1 ) ...  C j (v l ). C i1i1 C ikik CjCj i Such a DAG decomposition can be done in O(e) time, by using the following algorithm.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS G 1 /G 2 - a graph obtained by deleting the edges of G 2 from G 1. G 1  G 2 - a graph obtained by adding the edges of G 1 and G 2 together. (v, u) - an edge from v to u. d(v) - v’s outdegree. Algorithm graph-stratification(G) begin 1.V 1 := all the nodes with no outgoing edges; 2.for i = 1 to h - 1 do 3.{W := all the nodes that have at least one child in V i ; 4.for each node v in W do 5.{let v 1,..., v k be v’s children appearing in V i ; 6.C i (v) := {links to v 1,..., v k }; 7.if d(v) > k then remove v from W; 8.G := G/{(v, v 1 ),..., (v, v k )}; 9.d(v) := d(v) - k;} 10.V i+1 := W; 11.} end

Transitive Closure Compression Jan. 2013Yangjun Chen ACS In the above algorithm, we first determine V 1, which contains all those nodes having no outgoing edges (see line 1). In the subsequent computation, we determine V 2,..., V h. In order to determine V i (i > 1), we will first find all those nodes that have at least one child in V i-1 (see line 3), which are stored in a temporary variable W. For each node v in W, we will then check whether it also has some children not appearing in V i-1, which can be done in a constant time as demonstrated below. During the process, the graph G is reduced step by step, and so does d(v) for each v (see lines 8 and 9). First, we notice that after the jth iteration of the out-most for-loop, V 1,..., V j+1 are determined. Denote G j (V, E j ) the reduced graph after the jth iteration of the out-most for-loop. Then, any node v in G j, except those in V 1 ...  V j+1, does not have children appearing in V 1 ...  V j. Denote d j (v) the outdegree of v in G j. Thus, in order to check whether v appearing in G i-1 has some children not appearing in V i, we need only to check whether d i-1 (v) is strictly larger than k, the number of the child nodes of v appearing in V i (see line 7).

Transitive Closure Compression Jan. 2013Yangjun Chen ACS a f b c d e g h i a f V4:V4: a C 3 (a) = {c} f C 3 (f) = {b} V3:V3: b C 2 (b) = {c} C 1 (b) = {i} g C 2 (g) = {h} C 1 (g) = {d} V2:V2: c C 1 (c) = {d, e} h C 1 (h) = {e, i} V1:V1: die The nodes of the DAG are divided into four levels: V 1 = {d, e, i}, V 2 = {c, h}, V 3 = {b, g}, and V 4 = {a, f}. Associated with each node at each level is a set of links pointing to its children at different levels.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Find a minimum set of node disjoint chains for a given DAG G such that on each chain if node v is above node u, then there is a path from v to u in G. Step 1: Stratify G into a series of bipartite graphs. Step 2: Find a maximum matching for each bipartite graph (which may contain the so-called virtual nodes.) All the matchings make up a set of node-disjoint chains. Step 3: resolve all the virtual nodes.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Example. c f i ja be h d g c f i ja V0:V0: be h d g V1:V1: V2:V2: V0:V0: V1:V1: be h c f i ja be h c f i ja M1:M1: V1:V1: V2:V2: be h d g be h d g M2:M2:

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Example. be h c f i ja M1:M1: be h d g M2:M2: be h c f i ja d g a set of 6 chains be h c f i ja d g be h c f i ja d g a set of 5 chains M1  M2:M1  M2:

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Virtual Nodes -V i ’ = V i  {virtual nodes introduced into V i }. -C i =  {all the new edges from the nodes in V i to the virtual nodes introduced into V i-1 }. -G(V i, V i-1 ’, C i ) represents the bipartite graph containing V j and V i-1 ’.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Definition (virtual nodes for actual nodes) Let G(V, E) be a DAG, divided into V 0,..., V h-1 (i.e., V = V 0 ...  V h-1 ). Let M i be a maximum matching of the bipartite graph G(V i, V i-1 ’; C i ) and v be a free actual node (in V i-1 ’) relative to M i (i = 1,..., h - 1). Add a virtual node v’ into V i. In addition, for each node u  V i+1, a new edge u  v’ will be created if one of the following two conditions is satisfied: 1.u  v  E; or 2.There exists an edge (v 1, v 2 ) covered by M i such that v 1 and v are connected through an alternating path relative to M i ; and u  B i+1 (v 1 ) or u  B i+1 (v 2 ). v is called the source of v’, denoted s(v’). B j (v) represents a set of links with each pointing to one of v’s parents, which appears in V j.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Example. c f i ja be h d g c f i ja V0:V0: be h d g V1:V1: V2:V2: V0:V0: V1:V1: be h c f i ja be h c f i ja M1:M1: V 1 ’: V2:V2: bei’ d g h a’ bei’ d g h a’ M2:M2:

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Example. be h c f i ja M1:M1: bei’ d g h a’ M2:M2: be i’ c f i ja d g a set of 5 chains M1  M2:M1  M2: h a’ To obtain the final result, the virtual nodes have to be resolved.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Virtual node resolution Definition (alternating graph) Let M i be a maximum matching of G(V i, V i-1 ’; C i ). The alternating graph with respect to M i is a directed graph with the following sets of nodes and edges: V( ) = V i  V i-1 ’, and E( ) = {u  v | u  V i-1 ’, v  V i, and (u, v)  M i }  {v  u | u  V i-1 ’, v  V i, and (u, v)  C i \M i }.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Example. V0:V0: V1:V1: be h c f i j V 1 ’: V2:V2: bei’ d g h a’ : : fecb jha i i’de a’g

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Combined graph: Combine and by connecting some nodes v’ in to some nodes u in if the following conditions are satisfied. (i)v’ is a virtual node appearing in V i ’. (Note that V( ) = V i+1  V i ’.) (ii)There exist a node x in V i+1 and a node y in V i such that (x, v’)  M i+1, x  y  C i+1, and (y, u)  M i. bei’ d g h a’ : be h c f i j : XyXy X u

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Example. :: fecb jha i i’de a’g  i’de a’ g fecb jha i

Transitive Closure Compression Jan. 2013Yangjun Chen ACS In order to resolve as many virtual nodes (appearing in Vi’) as possible, we need to find a maximum set of node-disjoint paths (i.e., no two of these paths share any nodes), each starting at virtual node (in ) and ending at a free node in, or ending at a free node in. i’de a’ g fecb jha i i’e a’ g fecb jha i’e a’ g fecb i

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Generally, to find a maximum flow in a network, we need O(n 3 ) time. However, a network as constructed above is a 0-1 network. In addition, for each node v, we have either d in (v)  1 or d out (v)  1, where d in (v) and d out (v) represent the indegree and outdegree of v in , respectively. It is because each path in  is an alternating path relative to M i+1 or relative to M i. So each node except sources and sinks is an end node of an edge covered by M i+1 or by M i. As shown in ([14]), it needs only O(n 2.5 ) time to find a maximum flow in such kind of networks. -The problem of finding a maximal set of node-disjoint paths can be solved by transforming it to a maximum flow problem.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS i’e a’ g fecb jha be i’ c f i ja d g M1  M2:M1  M2: h a’ be i’ c f i ja d g h a’ Virtual nodes will be removed.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Definition (virtual nodes for virtual nodes) Let M i be a maximum matching of the bipartite graph G(V i, V i-1 ’; C i ) and v’ be a free virtual node (in V i-1 ’) relative to M i (i = 1,..., h - 1). Add a virtual node v’’ into V i. Set s(v’’) to be w = s(v’). Let l(w) = j. For each node u  V i+1, a new u  v’ will be created if there exists an edge (v 1, v 2 ) covered by M j+1 such that v 1 and w are connected through an alternating path relative to M j+1 ; and u  B i+1 (v 1 ) or u  B i+1 (v 2 ). Example. c fik bdh e g p q c f i k V0:V0: bd h V1:V1: e g V2:V2: p q V3:V3:

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Example. c f i k bd h M1:M1: c f i k V0:V0: bd h V1:V1: f’d h V 1 ’: e g V2:V2: bf’d h e g M 2 : bf’’d h V 2 ’: p q V3:V3: b’ f’’d h p q M3:M3: b’

Transitive Closure Compression Jan. 2013Yangjun Chen ACS b f’dh b’ f’’eg c fik p q b f’dh peg c fik q b dh peg c fik q

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Node-disjoint Paths in Combined Graphs Now we discuss an algorithm for finding a maximal set of node-disjoint paths in a combined graph . Its time complexity is bounded by O(e  n 1/2 ), where n = V(  ) and e = E(  ). It is in fact a modified version of Dinic’s algorithm [6], adapted to combined graphs, in which each path from a virtual node to a free node relative to M i+1 or relative to M i is an alternating path, and for each edge (u, v)  M i+1  M i, we have d out (u) = d in (v) = 1. Therefore, for any three nodes v, v’, and v’’ on a path in , we have d out (v) = d in (v’) = 1, or d out (v’) = d in (v’’) = 1. We call this property the alternating property, which enables us to do the task efficiently by using a dynamical arc-marking mechanism. An arc u  v with d out (u) = d in (v) = 1 is called a bridge.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Our algorithm works in multiple phases. In each phase, the arcs in  will be marked or unmarked. We also call a virtual node in  an origin and a free node a terminus. An origin is said to be saturated if one of its outgoing arcs is marked; and a terminus is saturated if one of its incoming arcs is marked. In the following discussion, we denote  by A. At the very beginning of the first phase, all the arcs in A are unmarked.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS In the kth phase (k  1), a subgraph A (k) of A will be explored, which is defined as follows. Let V 0 be the set of all the unsaturated origins (appearing in ). Define V j (j > 0) as below: E j-1 = {u  v  E(A) | u  V j-1, v  V 0  V 1 ...  V j-1, u  v is unmarked}  {v  u  E(A) | u  V j-1, v  V 0  V 1 ...  V j-1, v  u is marked}, V j = {v  V(A) | for some u, u  v is unmarked and u  v  E j-1 }  {v  V(A) | for some u, v  u is marked and v  u  E j-1 }.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Define j* = min{j | V j  {unsaturated terminus}   }. (Note that the terminus appearing in are the free nodes relative to M i+1 ; and those appearing in are the free nodes relative to M i.) If j* = 1, then V(A (k) ) = V 0  (V j*  {unsaturated terminus}), E(A (k) ) = {u  v | u  V j*-1, and v  {unsaturated terminus}}. If j* > 1, then V(A (k) ) = V 0  V 1 ...  V j*-1  (V j*  {unsaturated terminus}), E(A (k) ) = E 0  E 1 ...  E j*-2  {u  v | u  E j*-1, and v  {unsaturated terminus}}. The sets V j are called levels. A (k) is formed with V(A (k) ) and E(A (k) ) defined below.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS In, a node sequence v 1,..., v j, v j+1,..., v l is called a complete sequence if the following conditions are satisfied. (1)v 1 is an origin and v l is a terminus. (2)For each two consecutive nodes v j, v j+1 (j = 1,..., l - 1), we have an unmaked arc v j  v j+1 in A (k), or a marked arc v j+1  v j in A (k). Our algorithm will explore to find a set of node-disjoint complete sequences (i.e., no two of them share any nodes.) Then, we mark and unmark the arcs along each complete sequence as follows. (i)If (v j, v j+1 ) corresponds to an arc in A (k), mark that arc. (ii)If (v j+1, v j ) corresponds to an arc in A (k), unmark that arc. Obviously, if for an A (k) there exists j such that V j = Φ and V i  {unsaturated terminus} = Φ for i < j, we cannot find a complete sequence in it. In this case, we set A (k) to Φ and then the kth phase is the last phase.

Transitive Closure Compression Jan. 2013Yangjun Chen ACS a c e g b h d f a c e g b h d f a c e g b h d f a c e g b h d f a c e g b h d f

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Algorithm subgraph-exploring() begin 1.let v be the first element in V0; 2.push(v, H); mark v ‘accessed’; 3.while H is not empty do { 4.v := top(H); (*the top element of H is assigned to v.*) 5.while neighbor(v)  F do { 6.let u be the first element in neighbor(v); 7.if u is accessed then remove u from neighbor(v) 8.else {push(u, H); mark u ‘accessed’; v := u;} 9.} 10.if v is neither in V j * nor in V 0 then pop(H) 11.else {if v is in V j * then output all the elements in H; (*all the elements in H make up a complete sequence.*) 12.remove all elements in H; 13.let v be the next element in V 0 ; 14.push(v, H); mark v; 15.} end

Transitive Closure Compression Jan. 2013Yangjun Chen ACS Algorithm node-disjoint-paths(A) begin 1.k := 1; 2.construct A (1) ; 3.while A (k)   do { 4.call subgraph-exploring(A (k) ); 5.let P 1,... P l be all the found complete sequences; 6.for j = 1 to l do 7.{let P j = v 1, v 2,..., v m ; 8.mark v i  v i+1 or unmark v i+1  v i (i = 1,..., m - 1) according to (i) and (ii) above; 9.} 10.k := k + 1; construct A (k) ; 11.} end