Apply the reduction method in the appendix of Scholtus (2008) to a matrix. Let \(A\) with coefficients in \(\{-1,0,1\}\). If, after a possible permutation of columns it can be written in the form \(A=[B,C]\) where each column in \(B\) has at most 1 nonzero element, then \(A\) is totally unimodular if and only if \(C\) is totally unimodular. By transposition, a similar theorem holds for the rows of A. This function iteratively removes rows and columns with only 1 nonzero element from \(A\) and returns the reduced result.
reduceMatrix(A)
The reduction of A.
An object of class matrix in \(\{-1,0,1\}^{m\times n}\).
Scholtus S (2008). Algorithms for correcting some obvious inconsistencies and rounding errors in business survey data. Technical Report 08015, Netherlands.
is_totally_unimodular