ELSEVIER
Information
Processing
Letters 68 (1998) 3 13-3 15
Bandwidth of chain graphs Ton Kloks a$‘, Dieter Kratsch b,*, Haiko Miiller b,2 a Department of Applied Mathematics, Charles University, Prague, Czech Republic b Friedrich-Schiller-Universittit Jena, Fakultiitfiir Mathematik und Informatik, 07740 Jena, Germany Received 4 May 1998 Communicated by W.M. Turski
Abstract We show that there is an 0(n2 logn) algorithm to compute the bandwidth of a chain graph. Here n is the number of vertices in the graph. 0 1998 Elsevier Science B.V. All rights reserved. Keywords: Algorithms;
Graph algorithms;
Bandwidth;
Chain graphs
1. Introduction
2. Preliminaries
The BANDWIDTH problem for a graph is that of labeling its vertices with distinct integers so that the maximum difference across an edge is minimized. The BANDWIDTH problem for graphs has applications in sparse matrix computations. A bipartite graph G = (X, Y, E) is called a chain graph if the neighborhoods of the vertices in X form a chain, i.e., if there is an ordering of the vertices of X, say 1x1, . . . , x,,], such that
Let G = (V, E) be the number of vertices graph as G = (X, Y, E) color classes of G. We throughout.
Definition 1. A Zuyout L of a graph G is a l-1 mapping from V into (1,. . . , [VI). The width of L is defined as b(G, L) =max{
N(Xl) 2 N(X2)
2
. . .2 N(Xp).
It is easy to see that then the neighborhoods of vertices in Y also form a chain [ 131. In this note we show that the bandwidth of chain graphs can be computed in polynomial time.
* Corresponding author. Email:
[email protected]. ’ Email:
[email protected]. * Email:
[email protected].
a graph. We denote by n of G. We denote a bipartite where X and Y are the two denote 1x1 = p and IY I = q
The bandwidth bw(G)
=
IL(u) - L(u)1 I (u, v) E E}. of G is
min{b(G,
L) 1L is a layout of G}.
In general, computing the bandwidth of a graph is NP-complete [lo]. The problem remains NP-complete even on special classes of trees such as binary trees [3] and caterpillars with hairs of length at most three [9]. As far as the fixed parameter cases are concerned we can report the following results. It can be checked in linear time if the bandwidth of a graph is at most
0020-0190/98/$ - see front matter 0 1998 Elsevier Science B.V. All rights reserved PII:SOO20-0190(98)00173-2
314
Z Kloks et al. /Information
Processing Letters 68 (1998) 313-315
two [3], and for general k there is an O(nk) algorithm to check if the bandwidth of a graph is at most k [5]. This could well be ‘best possible’ since the problem is W[t]-hard for every t [2]. Only very few nontrivial graph classes are known for which the bandwidth is computable in polynomial time. These are theta graphs [l 11, caterpillars with hairs of length at most two [l] and interval graphs [7]. It was shown in [ 121 that the bandwidth of an interval graph can be computed in O(n logn) time, when the interval model of the graph is given. Recall that a graph is chordal if it does not contain an induced cycle of length at least four as an induced subgraph. A special kind of chordal graphs are the interval graphs (see, e.g., [4]). We shall use the characterization of [8] for interval graph. An asteroidal tripZe (abbreviated AT) of a graph is an independent set of three vertices x, y and z, such that between any two of them there exists a path P such that no vertex of P is adjacent to the third vertex of the triple. In [8] it is shown that a graph G is an interval graph if and only if G is chordal and does not contain an asteroidal triple. In [6] it is shown that the bandwidth of a graph is equal to its properpathwidth. The proper pathwidth of a graph G is defined as the minimum cardinality of a maximum clique of a proper interval supergraph of G decreased by one. A chordal graph H is called a triangulation of a graph G if H and G have the same set of vertices, and G is a subgraph of H. Definition 2. A bipartite graph G = (X, Y, E) is called a chain graph if the neighborhoods of the vertices of the color class X form a chain, i.e., the vertices of X can be ordered [XI, . . . , xp] such that N(xt) 2 N(x2) 2 . . . 3 N(Xp). Clearly, if G = (X, Y, E) is a chain graph then there exists an ordering [xl, . . . , xp] of X and an ordering [VI,...,ys] of Y such that N(xl) 2 . . . 2 N(xp) and N(Y1)
c ...
s N(Yq).
Henceforth we assume that these orderings of the vertices are given. If this is not the case, they can easily be computed in linear time by sorting the vertices according to their degrees. Since the BANDWIDTH problem remains NP-complete for such simple classes of graphs, and since a polynomial time algorithm to compute the bandwidth
exists for only a few, relatively small graph classes, it is worthwhile to investigate the bandwidth of chain graphs.
3. Bandwidth of chain graphs Let G = (X, Y, E) be a chain graph, with vertices of X and Y ordered [xl, . . . , xp] and [yl, . . . , yq] such that N(Xl) 1..
. 1 N(xp)
and
N(YI)
G . . . G N(Y,).
We assume that the graph is connected so that Y = N(xr) and X = N(y,). (If G is not connected the bandwidth is just the maximum bandwidth over all connected components.) Definition 3. Let Ho, HI, . . . , HP_] be the following graphs. Ho is obtained from G by making a clique of X. For i = 1 , . . . , p - 1, let e be the smallest index such that xi+1 is adjacent to ye. The graph Hi is obtained from G by making a clique of {xl, . . . , xi} mdof{ye,...,~~I.
Theorem 4. Ho, HI, . . . , HP_ 1 are interval graphs. Proof. The claim is clearly true for Ho. Let i 3 1, and let C be the smallest index such that xi+1 and ye are adjacent. Notice that Hi is a split graph, i.e., S = {xl,. . . , xi)U{y~,...,yq} inducesa clique in Hi and I = (xi+], . . .,xp) U {yl, . . ., ye_]} induces an independent set in Hi. Hence the graph Hi is chordal. Assume that Hi has an AT x, y an z. Notice that for two vertices in {xi+], . . _, xp}, or for two in {VI, . . . , ye_]}, one neighborhood is contained in the other, and hence they cannot both be in an AT. The only other possibility is that one vertex say x of the AT is in {xi+], . . . , xp}, one vertex, say y, is in ye-l} and z is in S. But then every path from (Yll..., x to y passes through S and hence contains a neighbor ofz. 0 Theorem 5. Every triangulation H of G has one of HP- 1 as a subgraph. Ho,HI,..., Proof. Let H be a triangulation of G. If X induces a clique in H then HO is a subgraph of H and if Y is
315
7: Kloks et al. /Information Processing Letters 68 (1998) 313-315
a clique of H then HI is a subgraph of H. Assume neither is the case. Take k maximal and t minimal such that (x 1, . . . , Xk } and {yr, . . . . yq} form cliques in H. We claim that xk+l is not adjacent to y,_ 1. If this were the case, then ({Xl 3.. ., Xk+ll, {yt-1 , . . . , ys}) would induce a complete bipartite subgraph in G. But every triangulation of a complete bipartite graph must be such that at least one of the color classes is a clique (otherwise there would be a chordless 4-cycle). This contradicts the fact that k is maximal and t is minimal. Now let !! be the minimal index such that Xk+l and ye are adjacent. Then it follows that JY. 3 t. This proves that Hk is a subgraph of H. 0 Corollary 6. The set of all minimal triangulations G iscontuinedin {Ho, . . . . HP-l).
of
Theorem 7. There exists an O(n210gn) time &gorithm computing the bandwidth of a chain graph G = (X, Y, E) with n vertices. Proof. Let H be triangulation of G into a proper interval graph such that the bandwidth of G is equal to the clique number minus one of H. By Theorem 5, one of the interval graphs HO, HI, . . . ) HP-l, say Hk is a subgraph of H. Since Hk is a triangulation of G we have bw(G) < bw(Hk) < bw(H) = bw(G). It is easy to see that an interval model for each Hi can be computed in linear time. Using the algorithm of [ 121, our algorithm computes the bandwidth of each Hi in time O(n log n). The minimum value gives, by the above argument, the bandwidth of G. IJ
4. Conclusion In this note we have given an easy algorithm which computes the bandwidth of a chain graph with n
vertices in O(n2 logn) time. Chain graphs form a proper subclass of the class of bipartite permutation graphs. It would be interesting to know whether our results can be extended to the class of all (bipartite) permutation graphs.
References [l] SE Assmamr, G.W. Peck, M. Sysb, J. Zak, The bandwidth of caterpillars with hairs of length 1 and 2, SIAM J. Algebraic Discrete Methods 2 (1981) 387-393. [2] H. Bodlaender, M.R. Fellows, M.T. Hallet, Beyond NP-completeness for problems of bounded width: Hardness for the W hierarchy, in: Proc. 26th STGC, 1994, pp. 449458. [3] M.R. Garey, R.L. Graham, D.S. Johnson, D.E. Knuth, Complexity results for bandwidth minimization, SIAM J. Appl. Math. 34 (1978) 477495. [4] M.C. Golumbic, Algorithmic Graph Theory Graphs, Academic Press, New York, 1980.
and
Perfect
[S] E. Gurari, I.H. Sudborough, Improved dynamic programming algorithms for the bandwidth minimization and the mincut linear arrangement problem, J. Algorithms 5 (1984) 531-546. [6] H. Kaplan, R. Shamir, Pathwidth, bandwidth and completion problems to proper interval graphs with small cliques, SIAM J. Computing 25 (1996) 540-561. [7] D.J. KIeitman, R.V. Vohra, Computing the bandwidth interval graphs, SIAM J. Discrete Math. 3 (1990) 373-375.
of
[8] C.E. Lekkerkerker, J.C. Boland, Representation of a finite graph by a set of intervals on a real line, Fund. Math. 51 (1962) 45-64. [Y] B. Monien, The bandwidth minimization problem for caterpillars with hairs of length 3 is NP-complete, SIAM J. Algebraic Discrete Methods 7 (1986) 505-512. [lo] C.H. Papadimitriou, The NP-completeness of the bandwidth minimization problem, Computing 16 (1976) 263-270. [ll]
G.W. Peck, A. Shastri, Bandwidth of theta graphs with short paths, Discrete Math. 103 (1992) 177-187.
[12] A.P. Sprague, An O(nlogn) algorithm for bandwidth interval graphs, SIAM J. Discrete Math. 7 (1994) 213-220. [13] M. Yannakakis, Node deletion problems SIAM J. Comput. 10 (1981) 310-327.
of
on bipartite graphs,