The consecutive ones property for rows of a (0,1)-matrix is the existence of a single permutation of its columns that makes the 1s consecutive in every row. Rows with no 1s impose no restriction. For the column version, permute rows instead, or apply the row version to the transpose.
Equivalently, the set of columns containing 1 in each row must occupy consecutive positions in a common ordering of all columns. For example, rows with 1s in columns 1 and 3 and in columns 2 and 3, respectively, permit the column order 1, 3, 2. A further row with 1s in columns 1 and 2 makes the conditions incompatible because all three pairs would have to be adjacent.
Booth and Lueker (1976) gave a linear time test using a PQ-tree. For a sparse matrix with rows,
columns, and
entries equal to 1, the time is
, where
denotes big-O notation.
Each row restricts the leaf orders of the tree to those in which the corresponding
columns are consecutive.
For a finite simple graph, form the vertex-clique (0,1)-matrix with one row per graph vertex and one column per maximal clique, and a 1 for membership. The graph is an interval graph iff this matrix has the consecutive ones property for rows (Fulkerson and Gross 1965).