• Markov chain;
  • Monte Carlo;
  • contingency tables;
  • approximate counting;
  • simulated annealing


We study the problem of counting and randomly sampling binary contingency tables. For given row and column sums, we are interested in approximately counting (or sampling) 0/1 n × m matrices with the specified row/column sums. We present a simulated annealing algorithm with running time O((nm)2D3dmax log 5(n + m)) for any row/column sums, where D is the number of nonzero entries and dmax is the maximum row/column sum. In the worst case, the running time of the algorithm is O(n11 log 5n) for an n × n matrix. This is the first algorithm to directly solve binary contingency tables for all row/column sums. Previous work reduced the problem to the permanent, or restricted attention to row/column sums that are close to regular. The interesting aspect of our simulated annealing algorithm is that it starts at a nontrivial instance, whose solution relies on the existence of short alternating paths in the graph constructed by a particular Greedy algorithm.© 2006 Wiley Periodicals, Inc. Random Struct. Alg., 2007