Quadratic Integer Programming with
Application to the Chaotic Mappings of
Complete Multipartite Graphs
1,2H. L. FU,3C. L. SHIUE,4X. CHENG,5D. Z. DU,6ANDJ. M. KIM7
Communicated by P. M. Pardalos
Abstract. Letα be a permutation of the vertex set V(G ) of a connec-ted graph G. Define the total relative displacement ofα in G by
δα(G )G ∑
x, y∈V (G )
兩dG(x, y)AdG(α(x),α(y))兩,
where dG(x, y) is the length of the shortest path between x and y in G. Letπ*(G ) be the maximum value ofδα(G ) among all permutations of
V (G ). The permutation which realizesπ*(G ) is called a chaotic map-ping of G. In this paper, we study the chaotic mapmap-pings of complete multipartite graphs. The problem is reduced to a quadratic integer pro-gramming problem. We characterize its optimal solution and present an algorithm running in O(n5
log n) time, where n is the total number of vertices in a complete multipartite graph.
Key Words. Chaotic mapping, complete multipartite graph, quadratic integer programming, optimal solution.
1
This paper was supported by ROC Grant 2115-M-009-019, ROC Grant NSC-89-2119-M-009-002, and PRC Program 973 on Information Technology and High-Performance Software.
2This work was motivated by the work of Ref. 1 and a personal communication with Dr. K.
B. Reid. We wish to thank him for his references and encouragement.
3Professor, Department of Applied Mathematics, National Chiao Thung University, Hsin Chu,
Taiwan.
4Professor, Mathematics Division, National Center for Theoretical Science, National Tsing
Hua University, Hsin Chu, Taiwan.
5
Graduate Student, Department of Computer Science and Engineering, University of Minnesota, Minneapolis, Minnesota.
6
Professor, Department of Computer Science and Engineering, University of Minnesota, Minneapolis, Minnesota.
7
Professor, Institute of Applied Mathematics, Chinese Academy of Sciences, Beijing, PRC. 545
1. Introduction
Let α be a permutation of the vertex set V(G ) of a connected graph
G. Define the total relative displacement ofα in G by δα(G )G
∑
x,y∈V (G )
兩dG(xAy)AdG(α(x),α(y))兩,
where dG(x, y) is the length of the shortest path between x and y in G. It is
easy to see that a permutationα of V(G ) is an automorphism of G if and only if the total relative displacement ofα in G is zero. Letπ(G ) andπ*(G ) denote respectively the smallest nonzero total relative displacement and the largest total relative displacement in G. The permutation which realizes π*(G ) is called a chaotic mapping of G. The chaotic mapping is related to the sorting problem in computer science (Refs. 2–4). Computingπ(G ) and π*(G ) is an important research topic in graph theory (Refs. 1, 5, 6). The exact value ofπ(G ) has been obtained for G, when G is a path or a complete multipartite graph Kn1,n2,...,ntin which all vertices are partitioned into t
sub-sets with cardinalities n1, n2, . . . , nt, respectively; an edge (u, û) exists if and
only if two vertices u and û belong to different subsets.
(i) See Ref. 5. Let G be a path with n vertices. Then, the minimum total relative displacement is π(G )G2nA4.
(ii) See Ref. 1. Let 1⁄n1⁄n2⁄· · ·⁄nt, where t¤2 and nt¤2. Then,
π(Kn1,n2,...,nt)G
冦
2nhC1A2, if 1Gn1G· · · GnhFnhC1⁄· · · ⁄ nt,
and t¤(hC1), for some h¤2, 2nk0, if 1Gn1Fn2or n1¤2 and
nkC1GnkC1 for some k, 1⁄k⁄tA1,
and 2Cnk0⁄n1Cn2, where k0 is the smallest index for which
nk0C1Gnk0C1, 2(n1Cn2A2), otherwise.
In this paper, we study how to compute π*(Kn1,n2,...,nk). This problem
can be reduced to a quadratic integer programming due to the following result.
Lemma 1.1. See Ref. 1. Let Kn1,n2,...,ntG(X1, X2, . . . , Xt) be a complete
V (Kn1,n2,...,nt). For each 1⁄i, j⁄t, define aijG兩Aij(α)兩G兩{x兩x∈Xiandα(x)∈Xj}兩. Then, δα(Kn1,n2,...,nt)G
∑
t i G1 n2 iA∑
1 ⁄ i, j ⁄ t a2 ij. (1)Since
∑
ti G1n2i is fixed for a given complete multipartite graph, theprob-lem of determining π*(Kn1,n2,...,nk) is equivalent to the following quadratic
integer programming: (QIP) min
∑
1 ⁄ i, j ⁄ t a2ij, s.t.∑
t i G1 aijGnj, for 1⁄j⁄t,∑
t j G1 aijGni, for 1⁄i⁄t, aij¤0 are integers.In this paper, we characterize the optimal solution of this minimization problem and present an algorithm running in O(n5log n) time, where n is the number of vertices in a complete multipartite graph. We also give explicit values of π*(Kn1,n2,...,nk), based on the characterization, in some
special cases.
2. Characterization of the Optimal Solution
Let AG(aij) be a tBt nonnegative matrix. We call
C G(ai1j1, ai1j2, ai2j2, ai2j3, ai3j3, . . . , aisjs, aisj1)
a cycle of length 2s, s¤2, in A. A cycle C of length 2s is said to be over-weight if either aikjk¤1 for 1⁄k⁄s and
ai1j1Aai1j2Cai2j2Aai2j3Cai3j3A· · ·CaisjsAaisj1Hs, or aikjkC1¤1 for 1⁄k⁄s, where jsC1Gj1, and
Below, we show a matrix with overweight cycle of length 2: A G
冤
3→1 ↑ ↓ 1←2 1 1 1 1 0冥
.It is not difficult to see that, since AG(aij) has an overweight cycle,
∑
a2
ijG
19 is not of minimum value under the constraints that the row sums and column sums are fixed. The next matrix A′G(a′ij) reaches a smaller value
∑
a′ij2G17, A′G冤
2 2 1 2 1 1 1 1 0冥
.Theorem 2.1. A G(aij) is an optimal solution of Problem (QIP) if and
only if no overweight cycle exists in A.
Proof. Necessity. Suppose that A has an overweight cycle CG (ai1j1, ai1j2, . . . , aisj1). Without loss of generality, assume that aikjk¤1 for
1⁄k⁄s and
ai1j1Aai1j2Cai2j2Aai2j3Cai3j3A· · ·CaisjsAaisj1Hs. Define A′G(a′ij), where
a′ijG
冦
aijA1, if (i, j)G(ik, jk) for some 1⁄k⁄s,
aijC1, if (i, j)G(ik, jkC1) for some 1⁄k⁄s,
aij, otherwise. Now,
∑
a2 ijA∑
a′ij2Ga2i1j1Ca 2 i1j2C· · ·Ca 2 isj1Aa′ 2 i1j1Aa′ 2 i1j2A· · ·Aa′ 2 isj1 G2(ai 1j1Cai2j2C· · ·Caisjs)−2(ai1j2Cai2j3C· · ·Caisj1)A2s H0.
Therefore,
∑
a2ij is not the minimum. Note that the row sums and column
sums of A and A′ are equal respectively. Hence, we have the proof for necessity.
Sufficiency. For contradiction, assume that all cycles of A are not overweight and
∑
a2ij is not the minimum. Let A*G(a*ij) denote an optimalsolution. Let
∆ijGaijAa*ij, 1⁄i, j⁄t.
Define a directed bipartite multigraph G with bipartition (X, Y ), where
X G{x1, x2, . . . , xt}, Y G{y1, y2, . . . , yt},
xi joins to yj with ∆ij edges if ∆ijH0, and xi joins from yj with ∆ij edges if
∆ijF0. Since
∑
t j G1 ∆ijG0, for 1⁄i⁄t, and∑
t i G1 ∆ijG0, for 1⁄j⁄t,the outdegree and indegree of each vertex in G are equal. Thus, each compo-nent of G has a directed Eulerian circuit, and hence G can be decomposed into directed cycles C1, C2, . . . , Cm. For each cycle Cl, define
w(Cl)G
∑
(xi,yj)∈Cl aijA∑
(yj,xi)∈Cl aij. Note that, ∆ijH0, for (xi, yj)∈Cl,and that∆ijH0 implies aij¤1, since a*ij¤0. Thus,
aij¤1, for (xi, yj)∈Cl.
This means that, if w(Cl)H兩E(Cl)兩兾2, where 兩E(Cl)兩 is the number of edges
in cycle Cl, then Cl introduces an overweight cycle in A. Since A has no
overweight cycle, we have
Therefore,
∑
1 ⁄ i, j ⁄ t a2ijA∑
1 ⁄ i, j ⁄ t a*ij2G∑
1 ⁄ i, j ⁄ t a2ijA∑
1 ⁄ i, j ⁄ t (aijA∆ij) 2 G2∑
1 ⁄ i, j ⁄ t aij∆ijA∑
1 ⁄ i, j ⁄ t ∆2 ij G2∑
m l G1 w(Cl)A∑
1 ⁄ i, j ⁄ t ∆2 ij ⁄2∑
m l G1 (1兾2)兩E(Cl)兩A∑
1⁄i, j⁄t ∆2 ij G兩E(G)兩A∑
1 ⁄ i, j ⁄ t ∆2 ij G∑
i, j 兩∆ij兩A∑
1 ⁄ i, j ⁄ t ∆2 ij ⁄0,where兩E(G)兩 denotes the number of edges in G. This contradicts the fact that A*G(a*ij) is an optimal solution, while AG(aij) is not. 䊐
With the above characterization, we are able to find a chaotic mapping for certain complete multipartite graphs.
Corollary 2.1. Let Km,n be a complete bipartite graph, and let lG
min{m, n}, where mCn¤4. Then, π*(Km,n)G2(mCnA2)l.
Proof. Let
A G
冤
mAl l l nAl冥
.Then, A has no overweight cycle. By Theorem 2.1 and (1), π*(Km,n)G(m2Cn2)A[(mAl )2C2l2C(nAl )2
G(−4)l2C2(mCn)l]
Corollary 2.2. In Kn1,n2,...,nt, if aijG(1兾t)(niCnj)A(1兾t
2)
∑
ti G1ni is a
nonnegative integer for each 1⁄i, j⁄t, then AG(aij) gives a chaotic
map-ping of Kn1,n2,...,ntand π*(Kn1,n2,...nt)G(1A2兾t)
∑
t i G1 n2iC(1兾t 2)冢
∑
t i G1 ni冣
2 .Proof. Since for each i and i′,
aijAai′jG(niAni′)兾t
and for each j and j′,
aijAaij′G(njAnj′)兾t,
all cycles in A have weight zero. By Theorem 2.1,
∑
a2ij is minimum. Thus,
A determines a chaotic mapping of Kn1, n2,...ntby mapping aijelements of the
partite set Xito the partite set Xj. Furthermore, it is easy to check that
π*(Kn1,n2,..., nt)G
∑
t i G1 n2iA∑
1 ⁄ i, j ⁄ t a2ij. 䊐Example 2.1. For a complete 3-partite graph K3,6,9with partite sets X1G{1, 2, 3},
X2G{4, 5, 6, 7, 8, 9},
X3G{10, 11, 12, 13, 14, 15, 16, 17, 18}, from Corollary 2.2, we have
A G
冤
0 1 2 1 2 3 2 3 4冥
, and π*(K3,6,9)G(1A2兾3)(32C62C92)C(1兾9)(3C6C9)2G78. One of the chaotic mappings is as follows:αG
冤
1 2 3 兩 4 5 6 7 8 9 兩 10 11 12 13 14 15 16 17 18 4 10 11 兩 1 5 6 12 13 14 兩 2 3 7 8 9 15 16 17 18冥
.Corollary 2.3. Let s G(s1, s2, . . . , st) be a t-tuple such that siG0 or 1,
1⁄i⁄t, and let n1As1, n2As2, . . . , ntAstbe a graphical sequence of a simple
graph. Then,
π*(Kn1,n2,...,nt)G
∑
t i G1
ni(niA1).
Proof. Since (n1As1, n2As2, . . . , ntAst) is a graphical sequence, let G
be a graph with such degree sequence. Moreover, let B(G )G[bij] be the
adjacent matrix of G. Now, define AG[aij] such that
aijGbij, for i≠j,
aiiGsi, for 1⁄i, j⁄t.
By direct counting, we see that A has no overweight cycles; thus, by Theorem 2.1, we have an optimal solution. By (1), we can figure out easily
π*(Kn1,n2,...,nt). 䊐
3. Algorithm
Theorem 2.1 suggests the following algorithm to compute π*(Kn1,n2,...,nt).
Algorithm 3.1. Start from an initial matrix (aij),
aijG
冦
ni,
0,
if iGj, if i≠j.
Carry out the following steps in each iteration.
Step 1. Check whether the matrix (aij) has an overweight cycle. If not,
then stop; we obtain π*(Kn1,n2,...,nt)G
∑
t i G1 n2iA∑
1 ⁄ i, j ⁄ t a2ij. Otherwise, go to Step 2.Step 2. Suppose that ai1j1, ai1j2, ai2j2, . . . , aisjs, aisj1) is an overweight cycle, with aikjk¤1 for 1⁄k⁄s and ai1j1Aai1j2Cai2j2A· · · CaisjsAaisj1Hs. Then, set
ai1j1←ai1j1A1, ai1j2←ai1j2C1,
ai2j2←ai2j2A1, · · · ,
aisjs←aisjsA1,
aisj1←aisj1C1.
Go to the next iteration. Note that, initially,
∑
1 ⁄ i, j ⁄ t a2ijG∑
t i G1 n2i.In each iteration, if Step 2 is performed, then this sum decreases at least by one. Therefore, the algorithm stops within
∑
ti G1n2iGO(n2) iterations, where
n G
∑
ti G1ni. In the following, we explain how to implement each iteration inO(n3log n) time. Therefore, we have the following theorem. Theorem 3.1. π*(Kn1,n2,...,nt) can be computed in O(n
5log n) time.
Proof. First, we construct a directed graph H with vertex set
V G{ûij兩aij¤1},
edge set
E G{(ûij, ûi′j′)兩i≠i′, j≠j′},
and edge weight
w(ûij, ûi′j′)G(1兾2)(aijCai′j′)Aaij′A1.
Note that 兩V兩⁄
∑
ti G1
niGn.
Therefore, H can be constructed in O(n2) time. 䊐 Lemma 3.1. The matrix (aij) has an overweight cycle if and only if H
has a simple directed cycle with positive total weight.
Proof. H has a directed cycle (ûi1j1, ûi2j2, . . . , ûisjs) with a positive total
weight if and only if aikjk¤1 for 1⁄k⁄s and
Now, let P be the subgraph of H induced by all edges with positive weight, and let Q be the subgraph of H induced by all edges with nonposi-tive weight. Replace each neganonposi-tive edge-weight in Q by its absolute value. Let Q′be the resulting edge-weighted directed graph.
(i) Check Whether P Contains a Directed Cycle. This can be done in at most O(n2) time. If yes, then we have found already a directed cycle of H with positive total weight. Otherwise, P is acyclic.
(ii) Compute the Shortest Path in Q′for Every Pair of Vertices. This can be done in O(n3) time. Let q(û
ij, ûi′j′) denote the length of the shortest
path from ûi jto ûi′j′in Q′.
Make nC1 disjoint copies P0, P1, . . . , Pnof P. Denote by ûkij the copy
of the vertex ûij in Pk. For each pair of vertices ûij and ûi′j′, with
q(ûij, ûi′j′)FS, add edges ûkA1ij , ûki′j′) for 1⁄k⁄n, each with weight
Aq(ûij, ûi′j′). Meanwhile, delete all edges in P0. This results in an acyclic directed graph R with O(n2) vertices.
Lemma 3.2. H has a simple directed cycle with positive total weight
if and only if either P contains a cycle or there exist i, j, k such that R has a directed path from û0
ij to ûkij with positive total weight.
Proof. Suppose that H has a simple directed cycle C with positive total weight. If every edge has a positive weight, then P contains a cycle. Otherwise, C can be decomposed into 2k paths alternatively in P and Q. Suppose that ûij is the starting vertex of such a path in Q. It is easy to see
that we can find a path from û0
ij to ûkij in graph R, with positive total weight,
corresponding to cycle C.
Conversely, if P contains a cycle or if there exist i, j, k such that R has a directed path from û0
ij to ûkij with positive total weight, then it is easy to
find a directed cycle C with positive total weight in H. This cycle may not be simple. However, it can be decomposed into several simple directed cycles, at least one with positive total weight, since the sum of weights of those simple directed cycles equals the positive total weight of C. 䊐
Now, for each pair of û0
ij and ûkij, compute the longest path from û0ij to
ûkij in R. Since R is acyclic, this can be done trivially by dynamic program-ming in O(n5) time.
In fact, there are at most n û0
i js and finding all longest paths from û0ij to
other vertices needs at most O(n2) time. However, we describe next a clever way running in O(n3log n) time.
Construct R′ from R by adding edges (ûkA1
ij , ûkij) for all 1⁄k⁄n and
by the vertices in P0∪P1. Let g(u, û) denote the length of the longest path
from vertex u to vertex û in R′. It is easy to see that there exist i, j, k such that R has a directed path from û0
ij to ûkij with positive total weight if and
only if g(û0
ij, ûnij)H0.
(iii) For every pair of vertices û1
ij and û2i′j′, compute the longest path
from û1
ij to û1i′j′. This can be done in O(n3) time since P1is acyclic.
(iv) For every pair of vertices û0
ij and û1i′j′, compute the longest path
from û0 ij to û1i′j′ g(û0 ij, û1i′j′)G max u∈V (P1)(−q(û 0 ij, u)Cg(u, û2i′j′)),
where V(P1) denotes the vertex set of P1. This can be done in O(n3) time.
Similarly, we can compute all
g(û0ij, û2i′j′)G max u∈V (P1) (g(û0 ij, u)Cg(u, û2i′j′)), g(û0 ij, û4i′j′)G max u∈V (P2) (g(û0 ij, u)Cg(u, û4i′j′)), g(û0ij, û 8 i′j′)G max u∈V (P4) (g(û0 ij, u)Cg(u, û 8 i′j′)), · · · g(û0ij, ûnij),
totally in O(n3log n) time.
This completes the proof of Theorem 3.1. 䊐
4. Conclusions
We have studied a quadratic integer programming problem with appli-cation in a graph problem and found an algorithm to solve the graph prob-lem in O(n5log n) time, where n is the number of vertices in the given graph. This is the first polynomial-time algorithm for this graph problem.
References
1. REID, K. B., Total Relatiûe Displacement of Vertex Permutations of Kn1,n2,...,nt, Preprint, California State University, San Marcos, California, 2000.
2. CHAO, C. C., and LIANG, W. Q., Arranging n Distinct Numbers on a Line or a
Circle to Reach Extreme Total Variations, European Journal of Combinatorics, Vol. 13, pp. 325–334, 1992.
3. HWANG, F. K., Extremal Permutations with Respect to Weak Majorizations,
European Journal of Combinatorics, Vol. 17, pp. 637–645, 1996.
4. LEVEOPOULOS, C., and PETERSSON, O., Heapsort-Adapted for Presorted Files,
Proceedings of a 1989 Workshop on Algorithms and Data Structures, Lecture Notes in Computer Science, Springer Verlag, Berlin, Germany, Vol. 382, pp. 499– 509, 1989.
5. AITKEN, W., Total Relatiûe Displacement of Permutations, Journal of
Combina-torial Theory, Vol. 87A, pp. 1–21, 1999.
6. CHARTRAND, G., GAVLAS, H., and VANDERJAGT, D. W., Near-Automorphisms
of Graphs, Proceedings of the 1996 8th Quadrennial International Conference on Graph Theory, Combinatorics, Algorithms, and Applications, Edited by Y. Alavi, D. Lick, and A. J. Schwenk, New Issues Press, Kalamazoo, Michigan, Vol. 1, pp. 181–192, 1999.