1
$\begingroup$

$\def\p{\phantom-}$Call a $\lbrace 0,-1,1\rbrace$-matrix $M$ an even sign configuration if every row of $M$ contains an even number of 1's and every column of $M$ contains an even number of $-1$'s. The matrix $$\begin{bmatrix} \p1 & -1 & 1 & 0 \\\\ -1 & \p1 & 0 & 1 \\\\ \p0 & -1 & 1 & 1 \\\\ -1 & \p0 & 0 & 0 \end{bmatrix}$$ is an example of an even sign configuration. The support of such a matrix $M$ is the matrix obtained from $M$ by taking absolute values.

Given a $\lbrace 0,1\rbrace$-matrix $A$ of square size $d\times d$, is it possible to decide in polynomial time (with respect to $d$) if $A$ is the support of an even sign configuration?

More or less equivalently, if a $\lbrace 0,1\rbrace$-matrix $A$ is the support of an even sign configuration, does there exist a polynomial time algorithm which finds an even sign configuration $M$ with support $A$?

This question is essentially question Complexity of a matching problem on the grid $\mathbb Z^2$ with the no-intersection condition removed.

Algebraic reformulation: An even sign configuration $M$ corresponds to two $\lbrace 0,1\rbrace$ matrices $A_+,A_-$ such that $M=A_+ -A_-$ such that $A_+ (A_-)^t$ has only zeros on the diagonal and the support of $M$ is given by $A_+ +A_-$.

Added after Domotorp's comment: It seems that finding a perfect matching in an arbitrary graph is NP-complete (Added afterwards: WRONG, see Tony Huynh's answer). (This would solve the problem: Consider the graph with vertices corresponding to all non-zero entries, put an edge between two vertices if they are either on a common row or column. Find a complete matching in this graph if it exists. Put a $-1$ at every vertex matched to a vertex of the same column and a $+1$ otherwise.) The graph associated as above is however special. The question makes thus still sense and is essentially a question on the existence of an efficient algorithm finding a complete matching in the class of graphs defined by supports of matrices (or equivalently by finite subsets of $\mathbb Z^2$).

$\endgroup$
6
  • $\begingroup$ I don't get it - if A has a row or column with an odd number of 1's, it cannot have an even sign configuration, while if this is not the case, you can pick M=A. $\endgroup$
    – domotorp
    Dec 18, 2012 at 15:16
  • $\begingroup$ I also don't see why this question is similar to the grid-matching problem, but if you remove the intersection condition there, then it is just about finding a matching in a graph (with max degree 4), so it is in P. $\endgroup$
    – domotorp
    Dec 18, 2012 at 15:22
  • $\begingroup$ @domotorp: Your first comment refers to a bugged version containing the wrong definition, I have corrected it since. I do not know if this answers your second question. But if finding a matching in an arbitrary graph is in P the answer to my question is YES (you cannot suppose that the degree is $4$ however). $\endgroup$ Dec 18, 2012 at 15:29
  • $\begingroup$ Why would you write that after my comment it seems that finding a matching is NP-complete when I wrote that it is in P? Whatever... $\endgroup$
    – domotorp
    Dec 18, 2012 at 18:49
  • $\begingroup$ @domotorp: I think it was an honest mistake by Roland, since he must have assumed that you meant that finding a perfect matching is only in P for graphs of maximum degree 4. Indeed, the main point of my answer was just to clear up this confusion. $\endgroup$
    – Tony Huynh
    Dec 18, 2012 at 19:01

1 Answer 1

2
$\begingroup$

The answer to both of your questions is yes.

As suggested by the edit, consider the graph $G(A)$ whose vertex set is the set of non-zero entries of $A$, and where two entries are adjacent if they are in the same row or column. Now, as mentioned in the latest edit, if $G(A)$ contains a perfect matching then $A$ is the support of an even sign configuration. On the other hand, if $A$ is the support of an even sign configuration, then it is easy to construct a perfect matching in $G(A)$.

Thus $A$ is the support of an even sign configuration if and only if $G(A)$ has a perfect matching.

Now, by Edmond's Blossom Algorithm, the problem of finding a perfect matching in an arbitrary graph (not just maximum degree 4) is in P. So both of your problems can be solved in polynomial-time.

$\endgroup$
2
  • $\begingroup$ Thank you very much. Looks like a great algorithm that would perhaps deserve to be better known! $\endgroup$ Dec 18, 2012 at 17:17
  • $\begingroup$ You're welcome. It is indeed a beautiful algorithm of my great-grandfather. $\endgroup$
    – Tony Huynh
    Dec 18, 2012 at 18:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.