A simple Test For the Consecutive Ones Property - PowerPoint PPT Presentation

1 / 44
About This Presentation
Title:

A simple Test For the Consecutive Ones Property

Description:

Given a (0,1)- matrix M, does there exist a PERMUTATION of ... To connect A,B, it suffices to make a adjacent to all rows in B and b adjacent to all rows in A. ... – PowerPoint PPT presentation

Number of Views:123
Avg rating:3.0/5.0
Slides: 45
Provided by: tina94
Category:

less

Transcript and Presenter's Notes

Title: A simple Test For the Consecutive Ones Property


1
A simple Test For the Consecutive Ones Property
  • Without PC-trees!

2
Consecutive 1s Property of matrices
  • Given a (0,1)- matrix M, does there exist a
    PERMUTATION of the COLUMINS of M such that the
    1s in the ROWS are consecutive? 1 2
    3 4 1 1 0 0 1 0 0
    1 0 1 1 0

3 2 1 40 1 1 00 0 1 11
1 0 0
3
Consecutive requirement on the rows
  • Each row i of M can be viewed as a requirement
    that those columns with a 1 in row j must be
    consecutive.
  • Booth and Lueker ?1976? showed that the
    consecutive ones property can be tested using P-Q
    trees in linear time.
  • They process the consecutive requirement in a row
    by row fashion.

4
P-Q Trees
  • Two types of internal nodes P-nodes
    Q-nodesChildren of a P-node can be permuted
    arbitrarilyChildren 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

5
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










6
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

7
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!!

8
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
Vnu
u\V
9
Ideal Situation
  • If there is a row ordering v1 , v2 ,,vm
    such that each vi strictly overlaps with some vj
    , j lti, 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

10
The General Case (I)
  • Define the graph G (G) on the set of rows whose
    edge set consists of those overlapping (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

11
Graph Composition and Decomposition
2
2
7
7
9
9
8
8
12
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

13
Decomposition of Consecutive Ones Matrix
1
2
3
9
8
7
5
4
6
10
11
14
Overlapping Graph G
2
3
1
7
6
9
11
10
8
5
4
15
Strictly Overlapping Graph G
2
3
1
7
6
9
11
10
8
5
4
16
Spanning Forest of the Strictly Overlapping Graph
G
2
3
1
7
6
9
11
10
8
5
4
17
Another example of the Graph G
10
5
8
6
2
9
1
4
7
3
6
10
1
5
4
8
2
3
9
7
18
The General Case (II)
  • 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

19
COP Testing with Good Row Ordering
20
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

21
An Efficiency Note
b
B
  • 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.

A
a
22
An Efficiency Note
b
B
  • 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.

A
a
23
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 vB
are forbidden to be made adjacent to A, B,
respectively (to avoid incorrect s. o. edge
formed)
24
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)

25
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
26
After a row u is processed
  • All of its columns are shrunk to one artificial
    column u (the main reduction)
  • All the 1s 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.

27
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
28
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.
29
(No Transcript)
30
(No Transcript)
31
Lemma 1
  • If uj ? FB(ui)?PT(ui), iltj, ui and uj are
    connected in G

32
Lemma 2
  • If one of the ui and uj (iltj) 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
33
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

34
Claim 1
  • G" is a subgraph of G'

1. ui and uj are independent originally.
uk
uk
ukA
0.5
ukB
0.5
In this case, ui is in FB(uj) and uj is in FB(ui)
2. ui is contained in uj originally. (Lemma 2)
35
Claim 2
  • If(ui, uj) ? E(G'), then ui and uj belong to the
    same component of G".
  • Let ui,uj be the minimal bad pair. (for all other
    bad pair (up,uq) either iltp or jltq)
  • Consider the changing of intersection
    relationship
  • intersect to contain (case 1)
  • intersect to independent (case 2)

36
Case 1. intersect changed to contain
  • ui and uj intersect originally. Let one of the ui
    and uj be 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)

37
Case 1.1 Both ui and uj overlap uk
uk
ui
uj
ui is connected to uj through uk
uk
ui
uj
38
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
39
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 (tlt p-1(eA) )
uk
uk
eA
eA
z
z
ukA
ukA
t
p-1(eA) lt p-1(z) lt p-1(utD) eA connects utD. utD
connects t. t connects z.
p-1(eA) lt p-1(ukA) lt p-1(z)
40
Case 1.2
  • Case (iii) ukA is indepenet eA originally
  • Let ukA overlap eA atfer interation t. ukA is
    connected to eA via ut
  • Case (iv) ukA intersect 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".

41
Case 2. intersect changed to independent
  • ui and uj intersect originally. Let one of the ui
    and uj become 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 ui and uj (said) z
    intersects uk
  • (The other is named eA)

42
Case 2.1 Both ui and uj overlap uk
uk
ui
uj
ui is connected to uj through uk in G"
uk
ui
uj
43
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
44
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 ukA is not connected to eA, (ukA ,eA) becomes
    the minimal bad pair. (a contradiction)
Write a Comment
User Comments (0)
About PowerShow.com