1 / 39

A simple Test For the Consecutive Ones Property

A simple Test For the Consecutive Ones Property. P-Q Trees. Two types of internal nodes: P-nodes & Q-nodes Children of a P-node can be “permuted arbitrarily” Children of a Q-node can only be “reversed” Q. P. 1. 2. 3. 4. L(T) = { all permutations generated by T }.

kovit
Download Presentation

A simple Test For the Consecutive Ones Property

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. A simple Test For the Consecutive Ones Property

  2. P-Q Trees Two types of internal nodes: P-nodes & Q-nodesChildren of a P-node can be “permuted arbitrarily”Children of a Q-node can only be “reversed”Q P 1 2 3 4 L(T) = { all permutations generated by T } In the example, L(T) = { 1234,1243,4321,3421 }

  3. Intermediate On-Line Operations PQ-tree and PC-tree implementations for the COP are “on-line”, i.e. you can see the rows only one at a time … … … … … … … … … …

  4. Off-Line vs On-Line • PC-tree algorithm is an on-line algorithm • We design a simple off-line algorithm • If one arranges the rows in a good order, then even a kid knows how to test C1P • In general we can apply graph decomposition to obtain a good ordering

  5. An intelligent off-line test • Assume all rows of the matrix are given at the beginning • Can we find a “good” order of the rows to be processed for the COP test so that the test becomes easier? • No more PQ-trees nor PC-trees. • Even a child can perform the test for you!!

  6. Strictly Overlapping (S.O.) Relationships Two rows are said to overlap strictly if they overlap but none is contained in the other.Such a pair of rows implies the following column partition: 1 - - - - - - 1 1 - - - 1 1 - - - - 1 u v V\u V∩u u\V

  7. Ideal Situation If there is a row ordering v1 , v2 ,…,vm such that each vi strictly overlaps with some vj , j <i, then it is trivial to test the consecutive ones propertyPartition Before 1- - - - - - 1 1 - - - 1 1 - - - - 1 After 1 - - - 1 1 - - 1 1 - - 1 1 - - - 1 1 - - - - 1

  8. The strictly overlapping graph • Define the graph G on the set of rows whose edge set consists of those strictly overlapping pairs of columns. • Each connected component of G satisfies the above “ideal situation”. • Why? Consider a spanning tree and a breadth-first order • The corresponding submatrices are called prime • Can show that the matrix satisfies the COP iff each of its prime submatrices does

  9. Strictly Overlapping Graph G 2 3 1 7 6 9 11 10 8 5 4

  10. Decomposition of Consecutive Ones Matrix 1 2 3 9 8 7 5 4 6 10 11

  11. Decomposition – A Divide and Conquer Strategy • Divide and conquer • To reduce complexity • To make the problem easier to solve • To simplify a graph algorithm, we can decompose the graph until the problem becomes easier to solve on the final components • If the decomposition operation is also very efficient, then we will get an efficient algorithm at the end

  12. Another example of the Graph G 10 5 8 6 2 9 1 4 7 3 10 6 1 5 4 8 2 3 9 7

  13. A spanning subgraph G’ of G • However, we cannot afford to compute all the edges in G, which could take O( r 2 ) time. • We shall compute a subset of edges that contain a spanning tree of each connected component. • Note that the process of obtaining the component actually decompose the matrix into prime submatrices

  14. COP Testing with Good Row Ordering

  15. Exact Algorithm for Consecutive Ones Testing 1. Construct a subgraph G’ which contains a spanning tree of G ( the S. O. graph ). Each connected component corresponds to a prime submatrix. ( matrix decomposition ) 2. Decide a good ordering of a prime matrix based on BFS. • For each prime matrix determine the ordering of columns, using the set partition strategy as described in the following slides. • Process the rows from small to large

  16. An Efficiency Note Assume every row in A strictly overlaps every one in B. The # of strictly adjacent pairs is |A||B| . Let a, b bethe least indexed rows in A,B, respectively. To connect A,B in the graph, it suffices to make a adjacent to all rows in B and b adjacent to all rows in A. b B A a

  17. An Efficiency Note The # of strictly adjacent pairs is |A||B| . Let a, b bethe least indexed rows in A,B, respectively. To connect A,B, it suffices to make a adjacent to all rows in B and b adjacent to all rows in A. b B A a

  18. Representative Rows vA and vB v 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 vB vA v vB 1/2 vB vA vA 1/2 Let v be adjacent to both A and B. But, vA and vBare forbidden to be made adjacent to A, B, respectively (to avoid incorrect s. o. edge formed)

  19. Classifying the neighbors of a row u u B A C D • Append A(u),B(u) and D(u) to PT(u) (the set of candidates that are potentially s. o. with u) . • Append uD to PT(w) for all w in C(u) whose index is smaller than Ind(uD) • Delete the row u and use an artificial column [u] to replace the region covered by columns of u • Add edges from u to nodes of PT(u)-FB(u) (the set of rows forbidden to be s. o. with u)

  20. Partition the columns within row uThis is relatively unique u At the end of the iteration, no longer have to worry about the columns within u

  21. After a row u is processed • All of its columns are shrunk to one artificial column [u] (the main reduction) • All the 1’s for rows in A, B in columns of u are eliminated except to save ½ for vA and vB (to discover future strictly overlapping relations) • Save a 1 for rows in C and eliminate all rows in D.

  22. Which S. O. relations have been Changed? u vB B A vA C F E All those rows which have s. o. relation changed are connected to u i.e. they belong to the same component as u does

  23. Afterwards u vB B A vA C F E The connected components do not change after the reduction of u Rows that were not s. o. cannot become s. o.

  24. 1 1 1 0 0 0 0 00 0 0 1 10 0 1 1 01 1 0 0 00 1 1 0 01 1 0 0 0 3 6 2 0 0 1 5 2 3 0 0 4 4 0 0 5 0 0 1 6 6 0 1 1 1 2 0 0 0 00 0 0 10 1 1 00 0 1 1.5 0 1 1 6 3 3 1 0 5 2 4 0 0 4 0 0 5 6 0 0 1 6 3 2

  25. 1 .5 3 3 0 0 0 0 1 1 0 0 1 .5 1 1 6 4 0 0 5 5 1 0 4 3 2 1 6 6 0 0 5 6 5 00.5 0.50 1 1 4 4 1 6 3 2 5 0 1 6 1 1 4 5 6 5 .5 .5 0.5 5 1 6 3 2 6 1 0 4 5

  26. Lemma 1 • If uj FB(ui)∪PT(ui), i<j, ui and uj are connected in G’

  27. Lemma 2 • If one of the ui and uj (i<j) is contained in the other and the containment is changed before iteraion i, ui and uj are connected in G’. uj uj 0 0.5 ui ui uk [uk]

  28. The sub-graph G’ generated by the algorithm G’ is a spanning sub-graph of G' with the same components. Claim 1. G’ is a subgraph of G. If(ui,uj) G, (ui,uj) G’ Claim 2. if(ui, uj) G, then ui and uj belong to the same component of G’

  29. Claim 1 G’ is a subgraph of G 1. ui and uj are independent originally. The only case they could be s.o. is when they become vA and vB for some u. [u] u vA 0.5 vB 0.5 In this case, ui is in FB(uj) and uj is in FB(ui) 2. ui is contained in uj originally. (apply Lemma 2)

  30. Claim 2 If(ui, uj)  E(G), then ui and uj belong to the same component of G’. • Suppose not. Let ui,uj be the minimal bad pair. (for all other bad pair (up,uq) either i<p or j<q) • Consider the changing of intersection relationship • “intersect” to “contain” (case 1) • “intersect” to “independent” (case 2)

  31. Case 1. “intersect” changed to “contain” • ui and ujintersect originally. Let one of the ui and ujbe contained in the other after iteration k. Consider the following two subcases: Case 1.1: Both ui and uj overlap uk. Case 1.2: Only one of the ui and uj (say, z) overlaps uk ( The other is named eA)

  32. Case 1.1 Both ui and uj overlap uk uk ui uj ui is connected to uj through uk uk ui uj

  33. Case 1.2 one of ui and uj (say, z) overlaps uk uk uk eA eA z z ukA uk is connected to z and ukA. We shall verify if ukA is connected to eA. eA z

  34. Case 1.2 Only one of the ui and uj (said) z overlaps uk • Case (i) uka is contained in eA originally By lemma 2, uka is connected to eA. • Case (ii) uka contains eA originally If z is deleted at iteration t (t< π-1(eA) ) uk uk eA eA z z ukA ukA t π-1(eA) < π-1(z) < π-1(utD) eA connects utD. utD connects t. t connects z. π-1(eA) < π-1(ukA) < π-1(z)

  35. Case 1.2 • Case (iii) ukA is indepenet eA originally Let ukA overlaps eA after iteration t. ukA is connected to eAvia ut • Case (iv) ukA intersects eA originally (ukA, eA)becomes the minimal bad pair. (a contradiction) It concludes that ukA is connected to eA in G" such that eA and z is connected in G".

  36. Case 2. ““intersect” changed to “independent” • ui and ujintersect originally. Let one of the ui and ujbecome indepedent after iteration k. consider the following two subcases: Case 2.1: Both ui and uj overlap uk. Case 2.2: Only one of the uiand uj (said) zintersectsuk (The other is named eA)

  37. Case 2.1 Both ui and uj overlap uk uk ui uj ui is connected to uj through ukin G’ uk ui uj

  38. Case 2.2 Only one of the ui and uj (say, z) intersects uk uk eA eA z z ukA eA uk is connected to z and ukA. We shall verify if ukA is connected to eA. z

  39. Case 2.2 Only one of the ui and uj (said) z intersects uk • (i) ukA is independent to eA or one is contained in the other originally. Check Claim 1 • (ii) ukA intersects eA originally. If ukAis not connected to eA, (ukA ,eA) becomes the minimal bad pair. (a contradiction)

More Related