# Bipartite realization algorithm

This article was considered for deletion at Wikipedia on July 25 2014. This is a backup of Wikipedia:Bipartite_realization_algorithm. All of its AfDs can be found at Wikipedia:Special:PrefixIndex/Wikipedia:Articles_for_deletion/Bipartite_realization_algorithm, the first at Wikipedia:Wikipedia:Articles_for_deletion/Bipartite_realization_algorithm. Purge

DPv2 loves original research.

The Bipartite realization algorithm is an algorithm in graph theory solving the bipartite realization problem, i.e. the question if there exists for two finite lists of nonnegative integers a simple bipartite graph such that its degree sequence corresponds exactly to these lists. For a positive answer the pair of lists is called bigraphic. The algorithm constructs a special solution if one exists or proves that one cannot find a positive answer. The constructions is based on a recursive algorithm. It was never been published in a scientific paper but works similar as the Havel-Hakimi Algorithm for the graph realization problem or the Kleitman-Wang algorithms for the digraph realization problem.

## The algorithm

The algorithm is based on the following theorem.

Let [itex](a_1\dots,a_n)[/itex] and [itex](b_1,\dots,b_n)[/itex] be two finite lists of nonnegative integers such that [itex]a_1 \geq \dots \geq a_n[/itex] and let [itex]b_i >0[/itex]. The pair of lists [itex](a_1\dots,a_n)[/itex], [itex](b_1,\dots,b_n)[/itex] is bigraphic if and only if the pair of lists [itex](a_1-1,\dots,a_{b_i}-1,a_{b_i+1},\dots,a_n)[/itex], [itex](b_1,\dots,b_{i-1},0,b_{i+1},\dots,b_n)[/itex] is bigraphic.

Is the given pair of lists bigraphic then the theorem will be applied at most [itex]n[/itex] times on the current pair of lists. This process ends when both lists only contain zeros. In each step of the algorithm one constructs the edges of a bipartite graph with vertices [itex]v_1,\cdots,v_n[/itex] and [itex]w_1,\cdots,w_n[/itex] in the two partite sets, i.e. if it is possible to reduce the lists, then we add edges [itex]\{w_i,v_1\},\{w_i,v_2\},\cdots,\{w_{i},v_{b_1}\}[/itex]. When one of the current lists contains negative entries in any step of the algorithm, the theorem proves that the lists from the beginning are not bigraphic.

## Proof

⇐:When the pair [itex](a_1-1,\dots,a_{b_i}-1,a_{b_i+1},\dots,a_n)[/itex], [itex](b_1,\dots,b_{i-1},0,b_{i+1},\dots,b_n)[/itex] is bigraphic, then there exists a labeled bipartite graph [itex]G(U,V, E)[/itex] with this degree sequence. Especially vertex [itex]v_i[/itex] has degree zero. We connect vertex [itex]v_i[/itex] with vertices [itex]u_1,\dots,u_{b_i}[/itex] by edges and get a bipartite graph with degree sequence [itex](a_1\dots,a_n)[/itex],[itex](b_1,\dots,b_n)[/itex].

⇒:We consider a bipartite graph [itex]G(U,V,E)[/itex] with degree sequence [itex](a_1\dots,a_n)[/itex], [itex](b_1,\dots,b_n)[/itex] such that a maximum number of vertices [itex]u_1,\dots,u_{b_i}[/itex] is adjacent to vertex [itex]v_i.[/itex] Assume one of these vertices say [itex]u_j[/itex] is not adjacent to vertex [itex]v_i.[/itex] Then there is a vertex [itex]u_k[/itex] with [itex]k>b_i \geq j[/itex] such that [itex]\{u_j,v_i\}[/itex] is no edge and [itex]\{u_k,v_i\}[/itex] is one. Since [itex]a_j \geq a_k[/itex] there is a further vertex [itex]v_l[/itex] such that [itex]\{u_j,v_l\}[/itex] is an edge and [itex]\{u_k,v_l\}[/itex] is none. We delete in [itex]G[/itex] the edges [itex]\{u_k,v_i\},\{u_j,v_l\}[/itex] and add the edges [itex]\{u_j,v_i\},\{u_k,v_l\}[/itex] obtaining a bipartite graph [itex]G'[/itex] with the same degree sequence. The number of adjacent vertices of vertex [itex]v_i[/itex] in [itex]u_1,\dots,u_{b_i}[/itex] is larger than in [itex]G[/itex] in contradiction to our assumption. We conclude that in [itex]G[/itex] vertex [itex]v_i[/itex] is adjacent to all vertices [itex]u_1,\dots,u_{b_i}[/itex]. We delete in [itex]G[/itex] all incident edges of [itex]v_i[/itex] and get a bipartite graph with degree sequence [itex](a_1-1,\dots,a_{b_i}-1,a_{b_i+1},\dots,a_n)[/itex], [itex](b_1,\dots,b_{i-1},0,b_{i+1},\dots,b_n)[/itex].