Kleitman–Wang algorithms explained

The Kleitman–Wang algorithms are two different algorithms in graph theory solving the digraph realization problem, i.e. the question if there exists for a finite list of nonnegative integer pairs a simple directed graph such that its degree sequence is exactly this list. For a positive answer the list of integer pairs is called digraphic. Both algorithms construct a special solution if one exists or prove that one cannot find a positive answer. These constructions are based on recursive algorithms. Kleitman and Wang gave these algorithms in 1973.

Kleitman–Wang algorithm (arbitrary choice of pairs)

The algorithm is based on the following theorem.

Let

S=((a1,b1),...,(an,bn))

be a finite list of nonnegative integers that is in nonincreasing lexicographical order and let

(ai,bi)

be a pair of nonnegative integers with

bi>0

. List

S

is digraphic if and only if the finite list

S'=((a1-1,b1),...,(a

bi-1
-1,b
bi-1
),(a
bi
,0),(a
bi+1
,b
bi+1
),(a
bi+2
,b
bi+2

),...,(an,bn))

has nonnegative integer pairs and is digraphic.

Note that the pair

(ai,bi)

is arbitrarily with the exception of pairs

(aj,0)

. If the given list

S

digraphic then the theorem will be applied at most

n

times setting in each further step

S:=S'

. This process ends when the whole list

S'

consists of

(0,0)

pairs. In each step of the algorithm one constructs the arcs of a digraph with vertices

v1,...,vn

, i.e. if it is possible to reduce the list

S

to

S'

, then we add arcs

(vi,v1),(vi,v2),...,(vi

,v
bi-1

),(vi,v

bi+1

)

. When the list

S

cannot be reduced to a list

S'

of nonnegative integer pairs in any step of this approach, the theorem proves that the list

S

from the beginning is not digraphic.

Kleitman–Wang algorithm (maximum choice of a pair)

The algorithm is based on the following theorem.

Let

S=((a1,b1),...,(an,bn))

be a finite list of nonnegative integers such that

a1\geqa2\geq\geqan

and let

(ai,bi)

be a pair such that

(bi,ai)

is maximal with respect to the lexicographical order under all pairs

(b1,a1),...,(bn,an)

. List

S

is digraphic if and only if the finite list

S'=((a1-1,b1),,(a

bi-1
-1,b
bi-1
),(a
bi
,0),(a
bi+1
,b
bi+1
),(a
bi+2
,b
bi+2

),...,(an,bn))

has nonnegative integer pairs and is digraphic.

Note that the list

S

must not be in lexicographical order as in the first version. If the given list

S

is digraphic, then the theorem will be applied at most

n

times, setting in each further step

S:=S'

. This process ends when the whole list

S'

consists of

(0,0)

pairs. In each step of the algorithm, one constructs the arcs of a digraph with vertices

v1,...,vn

, i.e. if it is possible to reduce the list

S

to

S'

, then one adds arcs

(vi,v1),(vi,v2),...,(vi,v

bi-1

),(vi,v

bi+1

)

. When the list

S

cannot be reduced to a list

S'

of nonnegative integer pairs in any step of this approach, the theorem proves that the list

S

from the beginning is not digraphic.

See also