Bipartite realization problem

The bipartite realization problem is a classical decision problem in graph theory, a branch of combinatorics. Given two finite sequences $$(a_1,\dots,a_n)$$ and $$(b_1,\dots,b_m)$$ of natural numbers with $$ m\leq n $$, the problem asks whether there is a labeled simple bipartite graph such that $$(a_1,\dots,a_n),(b_1,\dots,b_m)$$ is the degree sequence of this bipartite graph.

Solutions
The problem belongs to the complexity class P. This can be proven using the Gale–Ryser theorem, i.e., one has to validate the correctness of $$n$$ inequalities.

Other notations
The problem can also be stated in terms of zero-one matrices. The connection can be seen if one realizes that each bipartite graph has a biadjacency matrix where the column sums and row sums correspond to $$(a_1,\ldots,a_n)$$ and $$(b_1,\ldots,b_m)$$. The problem is then often denoted by 0-1-matrices for given row and column sums. In the classical literature the problem was sometimes stated in the context of contingency tables by contingency tables with given marginals. A third formulation is in terms of degree sequences of simple directed graphs with at most one loop per vertex. In this case the matrix is interpreted as the adjacency matrix of such a directed graph. When are pairs of non-negative integers ((a1,b1), ..., (an,bn)) the indegree-outdegree pairs of a labeled directed graph with at most one loop per vertex?

Related problems
Similar problems describe the degree sequences of simple graphs and simple directed graphs. The first problem is the so-called graph realization problem. The second is known as the digraph realization problem. The bipartite realization problem is equivalent to the question, if there exists a labeled bipartite subgraph of a complete bipartite graph to a given degree sequence. The hitchcock problem asks for such a subgraph minimizing the sum of the costs on each edge which are given for the complete bipartite graph. A further generalization is the f-factor problem for bipartite graphs, i.e. for a given bipartite graph one searches for a subgraph possessing a certain degree sequence. The problem uniform sampling a bipartite graph to a fixed degree sequence is to construct a solution for the bipartite realization problem with the additional constraint that each such solution comes with the same probability. This problem was shown to be in FPTAS for regular sequences by Catherine Greenhill (for regular bipartite graphs with a forbidden 1-factor) and for half-regular sequences by Erdős et al. The general problem is still unsolved.