Co-Clustering Under the Maximum Norm

Co-clustering, that is, partitioning a numerical matrix into homogeneous submatrices, has many applications ranging from bioinformatics to election analysis. Many interesting variants of co-clustering are NP-hard. We focus on the basic variant of co-clustering where the homogeneity of a submatrix is defined in terms of minimizing the maximum distance between two entries. In this context, we spot several NP-hard as well as a number of relevant polynomial-time solvable special cases, thus charting the border of tractabil- ity for this challenging data clustering problem. For instance, we provide polynomial-time solvability when having to partition the rows and columns into two subsets each (meaning that one obtains four submatrices). When partitioning rows and columns into three subsets each, however, we encounter NP-hardness even for input matrices containing only values from {0, 1, 2}.


Introduction
Co-clustering, also known as bi-clustering [1], performs a simultaneous clustering of the rows and columns of a data matrix. Roughly speaking, the problem is, given a numerical input matrix A, to partition the rows and columns of A into subsets minimizing a given cost function (measuring "homogeneity"). For a given subset I of rows and a subset J of columns, the corresponding cluster consists of all entries a ij with i ∈ I and j ∈ J. The cost function usually defines homogeneity in terms of distances (measured in some norm) between the entries of each cluster. Note that the variant where clusters are allowed to "overlap", meaning that some rows and columns are contained in multiple clusters, has also been studied [1]. We focus on the non-overlapping variant, which can be stated as follows.
CO-CLUSTERING L Input: A matrix A ∈ R m×n and two positive integers k, ∈ N. Task: Find a partition of A's rows into k subsets and a partition of A's columns into subsets, such that a given cost function (defined with respect to some norm L) is minimized for the corresponding clustering.
Co-clustering is a fundamental paradigm for unsupervised data analysis. Its applications range from microarrays and bioinformatics over recommender systems to election analysis [1][2][3][4].
Due to its enormous practical significance, there is a vast amount of literature discussing various variants; however, due to the observed NP-hardness of "almost all interesting variants" [1], most of the literature deals with heuristic, typically empirically-validated algorithms. Indeed, there has been very active research on co-clustering in terms of heuristic algorithms, while there is little substantial theoretical work for this important clustering problem. Motivated by an effort towards a deeper theoretical analysis, as started by Anagnostopoulos et al. [2], we further refine and strengthen the theoretical investigations on the computational complexity of a natural special case of CO-CLUSTERING L , namely we study the case of L being the maximum norm L ∞ , where the problem comes down to minimizing the maximum distance between entries of a cluster. This cost function might be a reasonable choice in practice due to its outlier sensitivity. In network security, for example, there often exists a vast amount of "normal" data points, whereas there are only very few "malicious" data points, which are outliers with respect to certain attributes. The maximum norm does not allow one to put entries with large differences into the same cluster, which is crucial for detecting possible attacks. The maximum norm can also be applied in a discretized setting, where input values are grouped (for example, replaced by integer values) according to their level of deviation from the mean of the respective attribute. It is then not allowed to put values of different ranges of the standard deviation into the same cluster. Last, but not least, we study an even more restricted clustering version, where the partitions of the rows and columns have to contain consecutive subsets. This version subsumes the problem of feature discretization, which is used as a preprocessing technique in data mining applications [5][6][7]. See Section 3.3 for this version.
Anagnostopoulos et al. [2] provided a thorough analysis of the polynomial-time approximability of CO-CLUSTERING L (with respect to L p -norms), presenting several constant-factor approximation algorithms. While their algorithms are almost straightforward, relying on one-dimensionally clustering first the rows and then the columns, their main contribution lies in the sophisticated mathematical analysis of the corresponding approximation factors. Note that Jegelka et al. [8] further generalized this approach to higher dimensions, then called tensor clustering. In this work, we study (efficient) exact instead of approximate solvability. To this end, by focusing on CO-CLUSTERING ∞ , we investigate a scenario that is combinatorially easier to grasp. In particular, our exact and combinatorial polynomial-time algorithms exploit structural properties of the input matrix and do not solely depend on one-dimensional approaches.

Related Work
Our main point of reference is the work of Anagnostopoulos et al. [2]. Their focus is on polynomial-time approximation algorithms, but they also provide computational hardness results. In particular, they point to challenging open questions concerning the cases k = = 2, k = 1, or binary input matrices. Within our more restricted setting using the maximum norm, we can resolve parts of these questions. The survey of Madeira and Oliveira [1] (according to Google Scholar, accessed December 2015, cited more than 1500 times) provides an excellent overview on the many variations of CO-CLUSTERING L , there called bi-clustering, and discusses many applications in bioinformatics and beyond. In particular, they also discuss Hartigan's [9] special case where the goal is to partition into uniform clusters (that is, each cluster has only one entry value). Our studies indeed generalize this very puristic scenario by not demanding completely uniform clusters (which would correspond to clusters with maximum entry difference zero), but allowing some variation between maximum and minimum cluster entries. Califano et al. [10] aim at clusterings where in each submatrix, the distance between entries within each row and within each column is upper-bounded. Recent work by Wulff et al. [11] considers a so-called "monochromatic" bi-clustering where the cost for each submatrix is defined as the number of minority entries. For binary data, this clustering task coincides with the L 1 -norm version of co-clustering, as defined by Anagnostopoulos et al. [2]. Wulff et al. [11] show the NP-hardness of monochromatic bi-clustering for binary data with an additional third value denoting missing entries (which are not considered in their cost function) and give a randomized polynomial-time approximation scheme (PTAS). Except for the work of Anagnostopoulos et al. [2] and Wulff et al. [11], all other investigations mentioned above are empirical in nature.

Our Contributions
In terms of defining "cluster homogeneity", we focus on minimizing the maximum distance between two entries within a cluster (maximum norm). Table 1 surveys most of our results. Our main conceptual contribution is to provide a seemingly first study on the exact complexity of a natural special case of CO-CLUSTERING L , thus potentially stimulating a promising field of research. Table 1. Overview of results for (k, )-CO-CLUSTERING ∞ with respect to various parameter constellations (m: number of rows; |Σ|: alphabet size; k/ : size of row/column partition; c: cost). A indicates that the corresponding value is considered as a parameter, where FPT (fixed-parameter tractable (FPT)) means that there is an algorithm solving the problem where the super-polynomial part in the running time is a function depending solely on the parameter. Multiple 's indicate a combined parameterization. Other non-constant values may be unbounded.
Our main technical contributions are as follows. Concerning the computational intractability results with respect to even strongly-restricted cases, we put much effort into finding the "right" problems to reduce from in order to make the reductions as natural and expressive as possible, thus making non-obvious connections to fields, such as geometric set covering. Moreover, seemingly for the first time in the context of co-clustering, we demonstrate that the inherent NP-hardness does not stem from the permutation combinatorics behind: the problem remains NP-hard when all clusters must consist of consecutive rows or columns. This is a strong constraint (the search space size is tremendously reduced, basically from k m · n to ( m k ) · ( n )), which directly gives a polynomial-time algorithm for k and being constants. Note that in the general case, we have NP-hardness for constant k and . Concerning the algorithmic results, we develop a novel reduction to SAT solving (instead of the standard reductions to integer linear programming). Notably, however, as opposed to previous work on polynomial-time approximation algorithms [2,8], our methods seem to be tailored for the two-dimensional case (co-clustering), and the higher dimensional case (tensor clustering) appears to be out of reach.

Formal Definitions and Preliminaries
We use standard terminology for matrices. A matrix A = (a ij ) ∈ R m×n consists of m rows and n columns where a ij denotes the entry in row i and column j. We define [n] := {1, 2, . . . , n} and [i, j] := {i, i + 1, . . . , j} for n, i, j ∈ N. For simplicity, we neglect the running times of arithmetical operations throughout this paper. Since we can assume that the input values of A are upper-bounded polynomially in the size mn of A (Observation 2), the blow-up in the running times is at most polynomial.

Problem Definition
We follow the terminology of Anagnostopoulos et al. [2]. For a matrix A ∈ R m×n , a (k, )-co-clustering is a pair (I, J ) consisting of a k-partition I = {I 1 , . . . , ) and an -partition J = {J 1 , . . . , J } of the column indices [n] of A. We call the elements of I (resp., J ) row blocks (column blocks, resp.). Additionally, we require I and J to not contain empty sets.
The cost of a co-clustering (under maximum norm, which is the only norm we consider here) is defined as the maximum difference between any two entries in any cluster, formally cost ∞ (I, J ) := max (r,s)∈[k]×[ ] (max A rs − min A rs ). Herein, max A rs (min A rs ) denotes the maximum (minimum, resp.) entry in A rs .
The decision variant of CO-CLUSTERING L with maximum norm is as follows.
CO-CLUSTERING ∞ Input: A matrix A ∈ R m×n , integers k, ∈ N and a cost c ≥ 0. Question: Is there a (k, )-co-clustering (I, J ) of A with cost ∞ (I, J ) ≤ c?
See Figure 1 for an introductory example. We define Σ := {a ij ∈ A | (i, j) ∈ [m] × [n]} to be the alphabet of the input matrix A (consisting of the numerical values that occur in A). Note that |Σ| ≤ mn. We use the abbreviation (k, )-CO-CLUSTERING ∞ to refer to CO-CLUSTERING ∞ with constants k, ∈ N, and by (k, * )-CO-CLUSTERING ∞ , we refer to the case where only k is constant and is part of the input. Clearly, CO-CLUSTERING ∞ is symmetric with respect to k and in the sense that any (k, )-co-clustering of a matrix A is equivalent to an ( , k)-co-clustering of the transposed matrix A T . Hence, we always assume that k ≤ .
The example shows two (2, 2)-co-clusterings (middle and right) of the same matrix A (left-hand side). It demonstrates that by sorting rows and columns according to the co-clustering, the clusters can be illustrated as submatrices of this (permuted) input matrix. The cost of the (2, 2)-co-clustering in the middle is three (because of the two left clusters), and that of the (2, 2)-co-clustering on the right-hand side is one. We next collect some simple observations. First, determining whether there is a cost-zero (perfect) co-clustering is easy. Moreover, since, for a binary alphabet, the only interesting case is a perfect co-clustering, we get the following. Observation 1. CO-CLUSTERING ∞ is solvable in O(mn) time for cost zero and also for any size-two alphabet.
Proof. Let (A, k, , 0) be a CO-CLUSTERING ∞ input instance. For a (k, )-co-clustering with cost zero, it holds that all entries of a cluster are equal. This is only possible if there are at most k different rows and at most different columns in A, since otherwise, there will be a cluster containing two different entries. Thus, the case c = 0 can be solved by lexicographically sorting the rows and columns of A in O(mn) time (e.g., using radix sort).
We further observe that the input matrix can, without loss of generality, be assumed to contain only integer values (by some rescaling arguments preserving the distance relations between elements).

Observation 2.
For any CO-CLUSTERING ∞ -instance with arbitrary alphabet Σ ⊂ R, one can find in O(|Σ| 2 ) time an equivalent instance with alphabet Σ ⊂ Z and cost value c ∈ N.
Proof. We show that for any instance with arbitrary alphabet Σ ⊂ R and cost c ≥ 0, there exists an equivalent instance with Σ ⊂ Z and c ∈ N. Let σ i be the i-th element of Σ with respect to any fixed ordering. The idea is that the cost value c determines which elements of Σ are allowed to appear together in a cluster of a cost-c co-clustering. Namely, in any cost-c co-clustering, two elements σ i = σ j can occur in the same cluster if and only if |σ i − σ j | ≤ c. These constraints can be encoded in an undirected graph G c : where each vertex corresponds to an element of Σ, and there is an edge between two vertices if and only if the corresponding elements can occur in the same cluster of a cost-c co-clustering. Now, observe that G c is a unit interval graph, since each vertex σ i can be represented by the Hence, replacing the elements σ i by σ i in the input matrix yields a matrix that has a cost-c co-clustering if and only if the original input matrix has a cost-c co-clustering. Thus, for any instance with alphabet Σ and cost c, there is an equivalent instance with alphabet Σ ⊆ {0, . . . , |Σ| 2 } and cost c ∈ {0, . . . , |Σ|}. Consequently, we can upper-bound the values in Σ by |Σ| 2 ≤ (mn) 2 .
Due to Observation 2, we henceforth assume for the rest of the paper that the input matrix contains integers.

Parameterized Algorithmics
We briefly introduce the relevant notions from parameterized algorithmics (refer to the monographs [12][13][14] for a detailed introduction). A parameterized problem, where each instance consists of the "classical" problem instance I and an integer ρ called parameter, is fixed-parameter tractable (FPT) if there is a computable function f and an algorithm solving any instance in f (ρ) · |I| O(1) time. The corresponding algorithm is called an FPT-algorithm.

Intractability Results
In the previous section, we observed that CO-CLUSTERING ∞ is easy to solve for binary input matrices (Observation 1). In contrast to this, we show in this section that its computational complexity significantly changes as soon as the input matrix contains at least three different entries. In fact, even for very restricted special cases, we can show NP-hardness. These special cases comprise co-clusterings with a constant number of clusters (Section 3.1) or input matrices with only two rows (Section 3.2). We also show the NP-hardness of finding co-clusterings where the row and column partitions are only allowed to contain consecutive blocks (Section 3.3).

Constant Number of Clusters
We start by showing that for input matrices containing three different entries, CO-CLUSTERING ∞ is NP-hard even if the co-clustering consists only of nine clusters.
Proof. We prove NP-hardness by reducing from the NP-complete 3-COLORING [15], where the task is to partition the vertex set of a undirected graph into three independent sets. Let G = (V, E) be a 3-COLORING instance with V = {v 1 , . . . , v n } and E = {e 1 , . . . , e m }. We construct a (3, 3)-CO-CLUSTERING ∞ instance (A ∈ {0, 1, 2} m×n , k := 3, := 3, c := 1) as follows. The columns of A correspond to the vertices V, and the rows correspond to the edges E. For an edge e i = {v j , v j } ∈ E with j < j , we set a ij := 0 and a ij := 2. All other matrix entries are set to 1. Hence, each row corresponding to an edge {v j , v j } consists of 1-entries except for the columns j and j , which contain 0 and 2 (see Figure 2). Thus, every co-clustering of A with a cost at most c = 1 puts column j and column j into different column blocks. We next prove that there is a (3, 3)-co-clustering of A with a cost at most c = 1 if and only if G admits a 3-coloring.  The corresponding matrix where the columns are labeled by vertices and the rows by edges with a (3, 3)-co-clustering of cost one. The coloring of the vertices determines the column partition into three columns blocks, whereas the row blocks are generated by the following simple scheme: edges where the vertex with a smaller index is red/blue (dark)/yellow (light) are in the first/second/third row block (e.g., the red-yellow edge {2, 5} is in the first block; the blue-red edge {1, 6} is in the second block; and the yellow-blue edge {3, 4} is in the third block).
First, assume that V 1 , V 2 , V 3 is a partition of the vertex set V into three independent sets. We define a (3, 3)-co-clustering (I, J ) of A as follows. The column partition J := {J 1 , J 2 , J 3 } one-to-one corresponds to the three sets V 1 , V 2 , V 3 , that is J s := {i | v i ∈ V s } for all s ∈ {1, 2, 3}. By the construction above, each row has exactly two non-1-entries being 0 and 2. We define the type of a row to be a permutation of 0, 1, 2, denoting which of the column blocks J 1 , J 2 , J 3 contain the 0-entry and the 2-entry. For example, a row is of type (2, 0, 1) if it has a 2 in a column of J 1 and a 0 in a column of J 2 . The row partition I := {I 1 , I 2 , I 3 } is defined as follows: All rows of type (0, 2, 1) or (0, 1, 2) are put into I 1 . Rows of type (2, 0, 1) or (1, 0, 2) are contained in I 2 , and the remaining rows of type (2, 1, 0) or (1, 2, 0) are contained in I 3 . Clearly, for (I, J ), it holds that the non-1-entries in any cluster are either all 0 or all 2, implying that cost ∞ (I, J ) ≤ 1.
Next, assume that (I, {J 1 , J 2 , J 3 }) is a (3, 3)-co-clustering of A with a cost at most 1. The vertex sets V 1 , V 2 , V 3 , where V s contains the vertices corresponding to the columns in J s , form three independent sets: if an edge connects two vertices in V s , then the corresponding row would have the 0-entry and the 2-entry in the same column block J s , yielding a cost of 2, which is a contradiction.
Theorem 1 can even be strengthened further.
is NP-hard for any k ≥ 3, even when ≥ 3 is fixed, and the column blocks are forced to have equal sizes |J 1 | = . . . = |J |.
Proof. Note that the reduction in Theorem 1 clearly holds for any k ≥ 3. Furthermore, -COLORING with balanced partition sizes is still NP-hard for ≥ 3 [15].

Constant Number of Rows
The reduction in the proof of Theorem 1 outputs matrices with an unbounded number of rows and columns containing only three different values. We now show that also the "dual restriction" is NP-hard, that is the input matrix only has a constant number of rows (two), but contains an unbounded number of different values. Interestingly, this special case is closely related to a two-dimensional variant of geometric set covering.
Proof. We give a polynomial-time reduction from the NP-complete BOX COVER problem [16]. Given a set P ⊆ Z 2 of n points in the plane and ∈ N, BOX COVER is the problem to decide whether there are squares S 1 , . . . , S , each with side length two, covering P, that is P ⊆ 1≤s≤ S s .
Let I = (P, ) be a BOX COVER instance. We define the instance I := (A, k, , c) as follows: The matrix A ∈ Z 2×n has the points p 1 , . . . , p n in P as columns. Further, we set k := 2, := , c := 2. See Figure 3 for a small example.  The correctness can be seen as follows: Assume that I is a yes-instance, that is there are squares S 1 , . . . , S covering all points in P. We define J 1 := {j | p j ∈ P ∩ S 1 } and J s := {j | p j ∈ P ∩ S s \ ( 1≤l<s S l )} for all 2 ≤ s ≤ . Note that (I := {{1}, {2}}, J := {J 1 , . . . , J }) is a (2, )-co-clustering of A. Moreover, since all points with indices in J s lie inside a square with side length two, it holds that each pair of entries in A 1s , as well as in A 2s has a distance at most two, Conversely, if I is a yes-instance, then let ({{1}, {2}}, J ) be the (2, )-co-clustering of a cost at most two. For any J s ∈ J , it holds that all points corresponding to the columns in J s have a pairwise distance at most two in both coordinates. Thus, there exists a square of side length two covering all of them.

Clustering into Consecutive Clusters
One is tempted to assume that the hardness of the previous special cases of CO-CLUSTERING ∞ is rooted in the fact that we are allowed to choose arbitrary subsets for the corresponding row and column partitions since the problem remains hard even for a constant number of clusters and also with equal cluster sizes. Hence, in this section, we consider a restricted version of CO-CLUSTERING ∞ , where the row and the column partition has to consist of consecutive blocks. Formally, for row indices The CONSECUTIVE CO-CLUSTERING ∞ problem now is to find a consecutive (k, )-co-clustering of a given input matrix with a given cost. Again, also this restriction is not sufficient to overcome the inherent intractability of co-clustering, that is we prove it to be NP-hard. Similarly to Section 3.2, we encounter a close relation of consecutive co-clustering to a geometric problem, namely to find an optimal discretization of the plane; a preprocessing problem with applications in data mining [5][6][7]. The NP-hard OPTIMAL DISCRETIZATION problem [6] is the following: Given a set S = B ∪ W of points in the plane, where each point is either colored black (B) or white (W), and integers k, ∈ N, decide whether there is a consistent set of k horizontal and vertical (axis-parallel) lines. That is, the vertical and horizontal lines partition the plane into rectangular regions, such that no region contains two points of different colors (see Figure 4 for an example). Here, a vertical (horizontal) line is a simple number denoting its x-(y-) coordinate.   Proof. We give a polynomial-time reduction from OPTIMAL DISCRETIZATION. Let (S, k, ) be an OPTIMAL DISCRETIZATION instance; let X := {x * 1 , . . . , x * n } be the set of different x-coordinates; and let Y := {y * 1 , . . . , y * m } be the set of different y-coordinates of the points in S. Note that n and m can be smaller than |S|, since two points can have the same xor y-coordinate. Furthermore, assume that x * 1 < . . . < x * n and y * 1 < . . . < y * m . We now define the CONSECUTIVE CO-CLUSTERING ∞ instance (A, k + 1, + 1, c) as follows: The matrix A ∈ {0, 1, 2} m×n has columns labeled with x * 1 , . . . , x * n and rows labeled with y * 1 , . . . , y * m . For (x, y) ∈ X × Y, the entry a xy is defined as zero if (x, y) ∈ W, two if (x, y) ∈ B and otherwise one. The cost is set to c := 1. Clearly, this instance can be constructed in polynomial time.
To verify the correctness of the reduction, assume first that I is a yes-instance, that is there is a set H = {x 1 , . . . , x k } of k horizontal lines and a set V = {y 1 , . . . , y } of vertical lines partitioning the plane consistently. We define row indices R := {r 1 , . . . , r k }, r i := max{x * ∈ X | x * ≤ x i } and column indices C := {c 1 , . . . , c }, c j := max{y * ∈ Y | y * ≤ y j }. For the corresponding (k + 1, + 1)-co-clustering (I R , J C ), it holds that no cluster contains both values zero and two, since otherwise the corresponding partition of the plane defined by H and V contains a region with two points of different colors, which contradicts consistency. Thus, we have cost ∞ (I R , J C ) ≤ 1, implying that I is a yes-instance.
Conversely, if I is a yes-instance, then there exists a (k + 1, + 1)-co-clustering (I R , J C ) with cost at most one, that is no cluster contains both values zero and two. Clearly, then, the k horizontal lines x i := min I i+1 , i = 1, . . . , k, and the vertical lines y j := min J j+1 , j = 1, . . . , are consistent. Hence, I is a yes-instance.
Note that even though CONSECUTIVE CO-CLUSTERING ∞ is NP-hard, there still is some difference in its computational complexity compared to the general version. In contrast to CO-CLUSTERING ∞ , the consecutive version is polynomial-time solvable for constants k and by simply trying out all O(m k n ) consecutive partitions of the rows and columns.

Tractability Results
In Section 3, we showed that CO-CLUSTERING ∞ is NP-hard for k = = 3 and also for k = 2 in the case of unbounded and |Σ|. In contrast to these hardness results, we now investigate which parameter combinations yield tractable cases. It turns out (Section 4.2) that the problem is polynomial-time solvable for k = = 2 and for k = 1. We can even solve the case k = 2 and ≥ 3 for |Σ| = 3 in polynomial time by showing that this case is in fact equivalent to the case k = = 2. Note that these tractability results nicely complement the hardness results from Section 3. We further show fixed-parameter tractability for the parameters size of the alphabet |Σ| and the number of column blocks (Section 4.3).
We start (Section 4.1) by describing a reduction of CO-CLUSTERING ∞ to CNF-SAT (the satisfiability problem for Boolean formulas in conjunctive normal form). Later on, it will be used in some special cases (see Theorems 5 and 7), because there, the corresponding formula, or an equivalent formula, only consists of clauses containing two literals, thus being a polynomial-time solvable 2-SAT instance.

Reduction to CNF-SAT Solving
In this section, we describe two approaches to solve CO-CLUSTERING ∞ via CNF-SAT. The first approach is based on a straightforward reduction of a CO-CLUSTERING ∞ instance to one CNF-SAT instance with clauses of size at least four. Note that this does not yield any theoretical improvements in general. Hence, we develop a second approach, which requires solving O(|Σ| k ) many CNF-SAT instances with clauses of size at most max{k, , 2}. The theoretical advantage of this approach is that if k and are constants, then there are only polynomially many CNF-SAT instances to solve. Moreover, the formulas contain smaller clauses (for k ≤ ≤ 2, we even obtain polynomial-time solvable 2-SAT instances). While the second approach leads to (theoretically) tractable special cases, it is not clear that it also performs better in practice. This is why we conducted some experiments for empirical comparison of the two approaches (in fact, it turns out that the straightforward approach allows one to solve larger instances). In the following, we describe the reductions in detail and briefly discuss the experimental results.
We start with the straightforward polynomial-time reduction from CO-CLUSTERING ∞ to CNF-SAT. We simply introduce a variable x i,r (y j,s ) for each pair of row index i ∈ [m] and row block index r ∈ [k] (respectively, column index j ∈ [n] and column block index s ∈ [ ]) denoting whether the respective row (column) may be put into the respective row (column) block. For each row i, we enforce that it is put into at least one row block with the clause (x i,1 ∨ . . . ∨ x i,k ) (analogously for the columns). We encode the cost constraints by introducing k clauses (¬x i,r ∨ ¬x i ,r ∨ ¬y j,s ∨ ¬y j ,s ), (r, s) ∈ [k] × [ ] for each pair of entries a ij , a i j ∈ A with |a ij − a i j | > c. These clauses simply ensure that a ij and a i j are not put into the same cluster. Note that this reduction yields a CNF-SAT instance with km + n variables and O((mn) 2 k ) clauses of size up to max{k, , 4}.
Based on experiments (using the PicoSAT Solver of Biere [17]), which we conducted on randomly generated synthetic data (of size up to m = n = 1000), as well as on a real-world dataset (animals with attributes dataset [18] with m = 50 and n = 85), we found that we can solve instances up to k = = 11 using the above CNF-SAT approach. In our experiments, we first computed an upper and a lower bound on the optimal cost value c and then created the CNF-SAT instances for decreasing values for c, starting from the upper bound. The upper and the lower bound have been obtained as follows: Given a (k, )-CO-CLUSTERING ∞ instance on A, solve (k, n)-CO-CLUSTERING ∞ and (m, )-CO-CLUSTERING ∞ separately for input matrix A. Let (I 1 , J 1 ) and (I 2 , J 2 ) denote the (k, n)and (m, )-co-clustering, respectively, and let their costs be c 1 := cost(I 1 , J 1 ) and c 2 := cost(I 2 , J 2 ). We take max{c 1 , c 2 } as a lower bound and c 1 + c 2 as an upper bound on the optimal cost value for an optimal (k, )-co-clustering of A. It is straightforward to argue the correctness of the lower bound, and we next show that c 1 + c 2 is an upper bound. Consider any pair (i, j), (i , j ) ∈ [m] × [n], such that i and i are in the same row block of I 1 , and j and j are in the same column block of J 2 (that is, a ij and a i j are in the same cluster). Then, it holds |a ij − a i j | ≤ |a ij − a i j | + |a i j − a i j | ≤ c 1 + c 2 . Hence, just taking the row partitions from (I 1 , J 1 ) and the column partitions from (I 2 , J 2 ) gives a combined (k, )-co-clustering of cost at most c 1 + c 2 .
From a theoretical perspective, the above naive approach of solving CO-CLUSTERING ∞ via CNF-SAT does not yield any improvement in terms of polynomial-time solvability. Therefore, we now describe a different approach, which leads to some polynomial-time solvable special cases. To this end, we introduce the concept of cluster boundaries, which are basically lower and upper bounds for the values in a cluster of a co-clustering. Formally, given two integers k, , an alphabet Σ and a cost c, we define a cluster boundary to be a matrix U = (u rs ) ∈ Σ k× . We say that a (k, )-co-clustering of A satisfies a cluster boundary It can easily be seen that a given (k, )-co-clustering has cost at most c if and only if it satisfies at least one cluster boundary (u rs ), namely the one with u rs = min A rs .
The following "subtask" of CO-CLUSTERING ∞ can be reduced to a certain CNF-SAT instance: Given a cluster boundary U and a CO-CLUSTERING ∞ instance I, find a co-clustering for I that satisfies U . The polynomial-time reduction provided by the following lemma can be used to obtain exact CO-CLUSTERING ∞ solutions with the help of SAT solvers, and we use it in our subsequent algorithms. Lemma 1. Given a CO-CLUSTERING ∞ -instance (A, k, , c) and a cluster boundary U , one can construct in polynomial time a CNF-SAT instance φ with at most max{k, , 2} variables per clause, such that φ is satisfiable if and only if there is a (k, )-co-clustering of A, which satisfies U .

Proof.
Given an instance (A, k, l, c) of CO-CLUSTERING ∞ and a cluster boundary U = (u rs ) ∈ Σ k× , we define the following Boolean variables: For each (i, r) ∈ [m] × [k], the variable x i,r represents the expression "row i could be put into row block I r ". Similarly, for each (j, s) ∈ [n] × [ ], the variable y j,s represents that "column j could be put into column block J s ".
We now define a Boolean CNF formula φ A,U containing the following clauses: a clause and a clause C j := (y j,1 ∨ y j,2 ∨ . . . ∨ y j, ) for each column j ∈ [n]. Additionally, for each (i, j) ∈ [m] × [n] and each (r, s) ∈ [k] × [ ], such that element a ij does not fit into the cluster boundary at coordinate (r, s), that is a ij / ∈ [u rs , u rs + c], there is a clause B ijrs := (¬x i,r ∨ ¬y j,s ). Note that the clauses R i and C j ensure that row i and column j are put into some row and some column block, respectively. The clause B ijrs expresses that it is impossible to have both row i in block I r and column j in block J s if a ij does not satisfy u rs ≤ a ij ≤ u rs + c. Clearly, φ A,U is satisfiable if and only if there exists a (k, )-co-clustering of A satisfying the cluster boundary U . Note that φ A,U consists of km + n variables and O(mnk ) clauses.
Using Lemma 1, we can solve CO-CLUSTERING ∞ by solving O(|Σ| k ) many CNF-SAT instances (one for each possible cluster boundary) with km + n variables and O(mnk ) clauses of size at most max{k, , 2}. We also implemented this approach for comparison with the straightforward reduction to CNF-SAT above. The bottleneck of this approach, however, is the number of possible cluster boundaries, which grows extremely quickly. While a single CNF-SAT instance can be solved quickly, generating all possible cluster boundaries together with the corresponding CNF formulas becomes quite expensive, such that we could only solve instances with very small values of |Σ| ≤ 4 and k ≤ ≤ 5.

Polynomial-Time Solvability
We first present a simple and efficient algorithm for (1, * )-CO-CLUSTERING ∞ , that is the variant where all rows belong to one row block. Proof. We show that Algorithm 1 solves (1, * )-CO-CLUSTERING ∞ . In fact, it even computes the minimum , such that A has a (1, )-co-clustering of cost c. The overall idea is that with only one row block all entries of a column j are contained in a cluster in any solution, and thus, it suffices to consider only the minimum α j and the maximum β j value in column j. More precisely, for a column block J ⊆ [n] of a solution, it follows that max{β j | j ∈ J} − min{α j | j ∈ J} ≤ c. The algorithm starts with the column j 1 that contains the overall minimum value α j 1 of the input matrix, that is Clearly, j 1 has to be contained in some column block, say J 1 . The algorithm then adds all other columns j to J 1 where β j ≤ α j 1 + c, removes the columns J 1 from the matrix and recursively proceeds with the column containing the minimum value of the remaining matrix. We continue with the correctness of the described procedure. Input: A ∈ R m×n , ≥ 1, c ≥ 0. Output: A partition of [n] into at most blocks yielding a cost of at most c, or no if no such partition exists. Let j s ∈ N be the index such that α j s is minimal; If Algorithm 1 returns (J 1 , . . . , J ) at Line 12, then this is a column partition into ≤ blocks satisfying the cost constraint. First, it is a partition by construction: the sets J s are successively removed from N until it is empty. Now, let s ∈ [ ]. Then, for all j ∈ J s , it holds α j ≥ α j s (by definition of j s ) and β j ≤ α j s + c (by definition of J s ). Thus, A 1s ⊆ [α j s , α j s + c] holds for all s ∈ [ ], which yields cost ∞ ({[m]}, {J 1 , . . . , J }) ≤ c.
Otherwise, if Algorithm 1 returns no in Line 5, then it is clearly a no-instance, since the difference between the maximum and the minimum value in a column is larger than c. If no is returned in Line 13, then the algorithm has computed column indices j s and column blocks J s for each s ∈ [ ], and there still exists at least one index j +1 in N when the algorithm terminates. We claim that the columns j 1 , . . . , j +1 all have to be in different blocks in any solution. To see this, consider any s, s ∈ [ + 1] with s < s . By construction, j s / ∈ J s . Therefore, β j s > α j s + c holds, and columns j s and j s contain elements with distance more than c. Thus, in any co-clustering with cost at most c, columns j 1 , . . . , j +1 must be in different blocks, which is impossible with only blocks. Hence, we indeed have a no-instance.
The time complexity is seen as follows. The first loop examines in O(mn) time all elements of the matrix. The second loop can be performed in O(n) time if the α j and the β j are sorted beforehand, requiring O(n log n) time. Overall, the running time is in O(n(m + log n)).
From now on, we focus on the k = 2 case, that is we need to partition the rows into two blocks. We first consider the simplest case, where also = 2.
Proof. We use the reduction to CNF-SAT provided by Lemma 1. First, note that a cluster boundary U ∈ Σ 2×2 can only be satisfied if it contains the elements min Σ and min{a ∈ Σ | a ≥ max Σ − c}. The algorithm enumerates all O(|Σ| 2 ) of these cluster boundaries. For a fixed U , we construct the Boolean formula φ A,U . Observe that this formula is in two-CNF form: The formula consists of k-clauses, -clauses and 2-clauses, and we have k = = 2. Hence, we can determine whether it is satisfiable in linear time [19] (note that the size of the formula is in O(mn)). Overall, the input is a yes-instance if and only if φ A,U is satisfiable for some cluster boundary U .
Finally, we show that it is possible to extend the above result to any number of column blocks for size-three alphabets.

Fixed-Parameter Tractability
We develop an algorithm solving (2, * )-CO-CLUSTERING ∞ for c = 1 based on our reduction to CNF-SAT (see Lemma 1). The main idea is, given matrix A and cluster boundary U , to simplify the Boolean formula φ A,U into a 2-SAT formula, which can be solved efficiently. This is made possible by the constraint on the cost, which imposes a very specific structure on the cluster boundary. This approach requires to enumerate all (exponentially many) possible cluster boundaries, but yields fixed-parameter tractability for the combined parameter ( , |Σ|).
In the following, we prove Theorem 7 in several steps. A first sub-result for the proof of Theorem 7 is the following lemma, which we use to solve the case where the number 2 m of possible row partitions is less than |Σ| .

Lemma 2.
For a fixed row partition I, one can solve CO-CLUSTERING ∞ in O(|Σ| k mn ) time. Moreover, CO-CLUSTERING ∞ is fixed-parameter tractable with respect to the combined parameter (m, k, , c).
Proof. Given a fixed row partition I, the algorithm enumerates all |Σ| k different cluster boundaries U = (u rs ). We say that a given column j fits in column block J s if, for each r ∈ [k] and i ∈ I r , we have a ij ∈ [u rs , u rs + c] (this can be decided in O(m) time for any pair (j, s)). The input is a yes-instance if and only if for some cluster boundary U , every column fits in at least one column block.
Fixed-parameter tractability with respect to (m, k, , c) is obtained from two simple further observations. First, all possible row partitions can be enumerated in O(k m ) time. Second, since each of the k clusters contains at most c + 1 different values, the alphabet size |Σ| for yes-instances is upper-bounded by (c + 1)k .
The following lemma, also used for the proof of Theorem 7, yields that even for the most difficult instances, there is no need to consider more than two column clusters to which any column can be assigned. Lemma 3. Let I = (A ∈ Σ m×n , k = 2, , c = 1) be an instance of (2, * )-CO-CLUSTERING ∞ , h 1 be an integer, 0 < h 1 < m, and U = (u rs ) be a cluster boundary with pairwise different columns, such that |u 1s − u 2s | = 1 for all s ∈ [ ].
Then, for any column j ∈ [n], two indices s j,1 and s j,2 can be computed in time O(mn), such that if I has a solution ({I 1 , I 2 }, {J 1 , . . . , J }) satisfying U with |I 1 | = h 1 , then it has one where each column j is assigned to either J s j,1 or J s j,2 .
Proof. We write h 2 = m − h 1 (h 2 = |I 2 | > 0 for any solution with h 1 = |I 1 |). Given a column j ∈ [n] and any element a ∈ Σ, we write a j for the number of entries with value a in column j. Consider a column block J s ⊆ [n], s ∈ [ ]. Write α, β, γ for the three values, such that U 1s \ U 2s = {α}, U 1s ∩ U 2s = {β} and U 2s \ U 1s = {γ}. Note that {α, β, γ} = {β − 1, β, β + 1}. We say that column j fits into column block J s if the following three conditions hold: Note that if Condition (1) is violated, then the column contains an element that is neither in U 1s nor in U 2s . If Condition (2) (respectively Condition (3)) is violated, then there are more than h 1 (respectively h 2 ) rows that have to be in row block I 1 (respectively I 2 ). Thus, if j does not fit into a column block J s , then there is no solution where j ∈ J s . We now need to find out, for each column, to which fitting column blocks it should be assigned.
Intuitively, we now prove that in most cases, a column has at most two fitting column blocks and, in the remaining cases, at most two pairs of "equivalent" column blocks.
Consider a given column j ∈ [n]. Write a = min{a ij | i ∈ [m]} and b = max{a ij | i ∈ [m]}. If b ≥ a + 3, then Condition (1) is always violated: j does not fit into any column block, and the instance is a no-instance. If b = a + 2, then, again, by Condition (1), j can only fit into a column block where {u 1s , u 2s } = {a, a + 1}. There are at most two such column blocks: we write s j,1 and s j,2 for their indices (s j,1 = s j,2 if a single column block fits). The other easy case is when b = a, i.e., all values in column j are equal to a. If j fits into column block J s , then, with Conditions (2) and (3), a ∈ U 1s ∩ U 2s , and J s is one of the at most two column blocks having β = a: again, we write s j,1 and s j,2 for their indices.
Finally, consider a column j with b = a + 1, and let s ∈ [ ] be such that j fits into J s . Then, by Condition (1), the "middle-value" for column block J s is β ∈ {a, b}. The pair (u 1s , u 2s ) must be from {(a − 1, a), (a, a − 1), (a, b), (b, a)}. We write J s 1 , . . . , J s 4 for the four column blocks (if they exist) corresponding to these four cases. We define s j,1 = s 1 if j fits into J s 1 , and s j,1 = s 3 otherwise. Similarly, we define s j,2 = s 2 if j fits into J s 2 , and s j,2 = s 4 otherwise.
Consider a solution assigning j to s * ∈ {s 1 , s 3 }, with s * = s j,1 . Since j must fit into J s * , the only possibility is that s * = s 3 and s j,1 = s 1 . Thus, j fits into both J s 1 and J s 3 , so Conditions (2) and (3) imply a j ≤ h 1 and b j ≤ h 2 . Since a j + b j = h 1 + h 2 = m, we have a j = h 1 and b j = h 2 . Thus, placing j in either column block yields the same row partition, namely I 1 = {i | a ij = a} and I 2 = {i | a ij = b}. Hence, the solution assigning j to J s 3 , can assign it to J s 1 = J s j,1 , instead, without any further need for modification.
Similarly, with s 2 and s 4 , any solution assigning j to J s 2 or J s 4 can assign it to J s j,2 without any other modification. Thus, since any solution must assign j to one of {J s 1 , . . . , J s 4 }, it can assign it to one of {J s j,1 , J s j,2 } instead.
We now give the proof of Theorem 7.
Proof. Let I = (A ∈ Σ m×n , k = 2, , c = 1) be a (2, * )-CO-CLUSTERING ∞ instance. The proof is by induction on . For = 1, the problem is solvable in O(n(m + log n)) time (Theorem 4). We now consider general values of . Note that if is large compared to m (that is, 2 m < |Σ| ), then one can directly guess the row partition and run the algorithm of Lemma 2. Thus, for the running time bound, we now assume that < m. By Observation 2, we can assume that Σ ⊂ Z.
We first show that instances implying a solution containing at least one column block with equal or non-overlapping bounds can easily be dealt with.

Claim 1.
If the solution contains a column-block with equal bounds, then it can be computed in O(|Σ| 2 n 2 m 2 ) time.
Proof. Assume, without loss of generality, that the last column block, J , has equal bounds. We try all possible values of u = u 1 . Note that column block J imposes no restrictions on the row partition. Hence, it can be determined independently of the rest of the co-clustering. More precisely, any column with all values in U 1 = U 2 = [u, u + c] can be put into this block, and all other columns have to end up in the − 1 other blocks, thus forming an instance of (2, − 1)-CO-CLUSTERING ∞ . By induction, each of these cases can be tested in O(|Σ| 2( −1) n 2 m( − 1)) time. Since we test all values of u, this procedure finds a solution with a column block having equal bounds in O(|Σ| · |Σ| 2( −1) n 2 m( − 1)) = O(|Σ| 2 n 2 m 2 ) time.

Claim 2.
If the solution contains a (non-empty) column-block with non-overlapping bounds, then it can be computed in O(|Σ| 2 n 2 m 2 ) time.
Proof. Write s for the index of the column block J s with non-overlapping bounds, and assume that, without loss of generality, u 1s + c < u 2s . We try all possible values of u = u 2s , and we examine each column j ∈ [n]. We remark that the row partition is entirely determined by column j if it belongs to column block J s . That is, if j ∈ J s , then I 1 = {i | a ij < u} and I 2 = {i | a ij ≥ u}. Using the algorithm described in Lemma 2, we deduce the column partition in O(|Σ| 2 −1 nm ) time, which is bounded by O(|Σ| 2 n 2 m 2 ).
We can now safely assume that the solution contains only column blocks with properly overlapping bounds. In a first step, we guess the values of the cluster boundary U = (u rs ). Note that, for each s ∈ [ ], we only need to consider the cases where 0 < |u 1s − u 2s | ≤ c, that is, for c = 1, we have u 2s = u 1s ± 1. Note also that, for any two distinct column blocks J s and J s , we have u 1s = u 1,s or u 2s = u 2,s . We then enumerate all possible values of h 1 = |I 1 | > 0 (the height of the first row block), and we write h 2 = m − h 1 = |I 2 | > 0. Overall, there are at most (2|Σ|) m cases to consider.
Using Lemma 3, we compute integers s j,1 , s j,2 for each column j, such that any solution satisfying the above conditions (cluster boundary U and |I 1 | = h 1 ) can be assumed to assign each column j to one of J s j,1 or J s j,2 .
We now introduce a 2-SAT formula allowing us to simultaneously assign the rows and columns to the possible blocks. Let φ A,U be the formula as provided by Lemma 1. Create a formula φ from φ A,U where, for each column j ∈ [n], the column clause C j is replaced by the smaller clause C j := (y j,s j,1 ∨ y j,s j,2 ). Note that φ is a 2-SAT formula, since all other clauses R i or B ijrs already contain at most two literals.
If φ is satisfiable, then φ A,U is satisfiable, and A admits a (2, )-co-clustering satisfying U . Conversely, if A admits a (2, )-co-clustering satisfying U with |I 1 | = h 1 , then, by the discussion above, there exists a co-clustering where each column j is in one of the column blocks J s j,1 or J s j,2 .
In the corresponding Boolean assignment, each clause of φ A,U is satisfied and each new column clause of φ is also satisfied. Hence, φ is satisfiable. Overall, for each cluster boundary U and each h 1 , we construct and solve the formula φ defined above. The matrix A admits a (2, )-co-clustering of cost one if and only if φ is satisfiable for some U and h 1 .
Finally, we obtain the following simple corollary.

Conclusions
Contrasting previous theoretical work on polynomial-time approximation algorithms [2,8], we started to closely investigate the time complexity of exactly solving the NP-hard CO-CLUSTERING ∞ problem, contributing a detailed view of its computational complexity landscape. Refer to Table 1 for an overview on most of our results.
Several open questions derive from our work. Perhaps the most pressing open question is whether the case k = 2 and ≥ 3 is polynomial-time solvable or NP-hard in general. So far, we only know that (2, * )-CO-CLUSTERING ∞ is polynomial-time solvable for ternary matrices (Theorem 6). Another open question is the computational complexity of higher-dimensional co-clustering versions, e.g., on three-dimensional tensors as input (the most basic case here corresponds to (2,2,2)-CO-CLUSTERING ∞ , that is partitioning each dimension into two subsets). Indeed, other than the techniques for deriving approximation algorithms [2,8], our exact methods do not seem to generalize to higher dimensions. Last, but not least, we do not know whether CONSECUTIVE CO-CLUSTERING ∞ is fixed-parameter tractable or W[1]-hard with respect to the combined parameter (k, ).
We conclude with the following more abstract vision on future research: Note that for the maximum norm, the cost value c defines a "conflict relation" on the values occurring in the input matrix. That is, for any two numbers σ, σ ∈ Σ with |σ − σ | > c, we know that they must end up in different clusters. These conflict pairs completely determine all constraints of a solution, since all other pairs can be grouped arbitrarily. This observation can be generalized to a graph model. Given a "conflict relation" R ⊆ ( Σ 2 ) determining which pairs are not allowed to be put together into a cluster, we can define the "conflict graph" (Σ, R). Studying co-clusterings in the context of such conflict graphs and their structural properties could be a promising and fruitful direction for future research.