Volume 15, Number 4
RECOGNITION
INFORMATION
PROCESSING
OF PERFECT ELIMINATION
LETTERS
3 I October 1982
BIPARTITE GRAPHS
k. GOH and D. ROTEM bdiversity of Waterloo, Department of Computer Science, Waterloo, Ontario N2L 3G1, Canada Received 20 July 1981; revised version received 15 July 1982 Perfect elimination (PE) I bipartite graphs were introduced by Golumbic and Goss where they were shown to represent sparse matrices (non symmetric) on which Gaussian elimination may be performed without fill-in. We propose an 0(n3) recognition algorithm for PE bipartite graphs which improves on the 0(n5) procedure suggested by Golumbic and Goss for this problem.
Keywords: Ripartite graphs, bisimplicia! edge, fill-in, perfect elimination
1. Introduction
WI
A graph G = (V, E) consists of a vertex set V and an edge set E of unordered pairs of vertices. Two vertices x, y E V are adjclcent if the edge xy E E, and two edges are adjacent if they share a common vertex. For a vertex v we denote by Adj(v) the set of all vertices which are adjacent to it. A subset A c V induces a subgraph (A, E(A)) where E(A) = {xy E Elx, y E A). A graph G = (V, E) is bipartite with vertex classes X, Y, if XUY=V, XnY=@and each edge in E joins a vertex in X to a vertex in Y. A bipartite graph (X U Y, E) is a complete bipartite graph if xy E E for every vertex x E X and y E Y. An edge xy is called bisimplicial if Adj(x) U Adj(y) induces a complete bipartite graph (see Fig. 1). In this paper, deleting an edge xy from a graph G = (V, E) means the removal of xy and all its adjacent edges from G, i.e., the resulting subgraph is the one induced by the set V - {x, y}* We denote by G - [e,, e,,..., ek ] the subgraph which is obtained by removing the edges e,, . . . , ek from G in this order. A bipartite graph G = (X U K, E) is called a perfect elimination (PE) bipartite graph if there exists a sequence of edges [e,, e,, . . . , e, ] such that (I ) e, is a bisimplicial edge in G and e, is bisimplicial in G - [e,, . . . . ei_ i] for 2 G i s t, C1020-0190/82/0000-0000/$02.75
G=
x2
x3
X4
y2
y3
Y4
;
Yl
Fig. 1. A PE bipartite graph. The edge x, y, is bisimplicial since {%~ YI, x *, yz} induces a complete bipartite graph in G, the edge x2y2 is not bisimplicial in G, but it is bisimplicial in G-x,Y,.
0 1982 North-Holland
(2) G - [e,, e2, . . . . e,] is empty. It is shown in [2] and [3] that the class of perfect elimination bipartite graphs is closely related to Gaussian elimination schemes on sparse matrices in the following way. Given a linear system of equations Mx = b where M is an n X n matrix, let B(M) = (X U Y, E) be a bipartite graph associated with the matrix M such that X = {x,, . . .,x “} and Y = (Y,,.*.r y,> correspond to the rows and columns of M respectively and xi yj E E if and only if the entry m,j in M is nonzero. The nonsingular matrix M (not necessarily symmetric) has a sequence of pivots which preserve zeroes if and only if B(M) is a perfect elimination bipartite graph. In most applications only the nonzero entries of PA are stored, hence if B(M) is PE bipartite, the sparseness of M and therefore its storagt requirei79
Volume 15, Number 4
ments can be preserved throughout the reduction of M during a Gaussian elimination process. The above characterization of matrices which have a ‘perfect elimination’ scheme generalizes previous resultsby Haskins and Rose [4] and Kleitman [S]. This motiv&es the search for a recognition algorithm for PE bipartite graphs since such an dgorithm answers the general decision problem whether a given sparse matrix M has a perfect elimination scheme. In case of a positive snswef, the algorithm also provides us with a sequence of pivots which reduce M to I (the identity matrix) without changing a zero entry into a nonzero. Clearly the recognition algorithm takes into account orily rhe structure of M, hence it can be run jbst ~f:.cefor a family of linear systems as long as mt-2;133 3 i, this family differ only in their right-hanJ side and/or the numerical values of the nonzero en@ies in M (see [3, Ch. 121 for more referents on matrix elimination problems and their relation to graph theory). The following tkxrem is proved in [2]. Tkorerm 1.1. If e is a bisimplicial edge oj a PE bipartite graph G, then G - [e] is also a PE bipartite gruph.
As noted in [2] this theorem suggests a.r~a&orithm for recognizing PE bipartite graphs and producing an elimination sche-me. We repeatedly find a bisimplicial edge of a bipartite graph and dele*.e it. If we succeed in eliminating all edges, then the bipartite graph was perfect elimination, otht:rwise it was not. The worst case running time of this algorithm for a graph with IX] = lY] = n is O(n’) sin;;.~for finding a single bisimplicial edge we have tr, check O(n*) edges for being bisimpliciai where each such check may require O(n*) steps. This procedure is repeated O(n) times since each elimination deletes one vertex from X and one vertex from Y. In the next section we present a recognition algorithm which requires only O(d) seps. 2. The Algon’thoro For convenience we will describe the algorithm ofmatri s. A bipartite graph G = (X u Y,
interms 180
31 October 1982
i,‘U’FORMATION PROCESSING LETTERS
E) with IX] = IY] = n can be represented by an n X n matrix IA zz (mij) where 1 IIlij
if xiyj EE,
=
0
otherwise.
A vector (a,, a2 ,..., a,,) majorizes the vector (b,, bz,..., b,,) if ai 3 bi for 1 si GE. Note that every vector majorizes itself by this definition. Our algorithm is based on the following lemma. Lemma 2.1 Let M = (mij) be an a X n (0,l) matrix representing a bipartite graph G = (X U Y, Ej. Let ei be the number of rows in M that majorize row i and Sj the sum of entries in column j of M. Then, if and or@ if the edge xiyj is a mij = 1 and ei=sj bisimplicial edge of G.
Roof. The ‘if part; For convenience we deuote f i by t and Sj by q. We have to show that xiyj is bisinrplicial. Let rows i ,,...,it majorize row i and be the nonzero elements in row i. mij,9**-,mijk Then Adj(xi)= (yj,,...,yjll}. Since rows i,,...,i, majorize row i, we have Adj(Xi,)
2 (Yj,
’
l
l
l
l
Yj,},
. Adjbi,)
2 (Yj,
l
Yj,)
l
Thus,since Yj E {Yj,,***,Yj,},Adj(Yj)> (X,,,*.*,xi,)* But the degree of yj is q = t SO we have Adj(yj) = {xi,9**g9Xi,}. NOW It is clear that Adj(xi) U Adj(yj) induces a complete bipartite subgraph of G. Hence, x iyjis a bisimplicial edge. The ‘only if part: Assume Xiyj is a bisimplicial edge of G. Then, since xi YjE E, we have m ij= 1 and hence all rows that majorize row i must have a 1 in column j. Therefore, the sum q of column j, is not smaller than t which is the number of rows that majorize row i. If q > t, then there exists an i’ e (i, ,..., it} such that milj = 11,i.e., XisYjE E and xi- E Adj(yj) but row i’ does not majorize row i. Hence there exists a jr E (jl,...,jk} (the set of column indices of nonzero elements in row i) such that mi,j, = 0, i.e., xi*yv e E. NOW, since Xi" E Adj(yj) and yjf E Adj(xi), Ad$x i) U AdjQ) d&s not induce a complete bipartite graph in G and xiyj is not a bisimplicial
Volume 15, Number 4
INFORMATION PROCESSING LETTERS
edge which gives the required contradiction.
Cl
31 October 1982
else simplical -found + false; end; if simplical_found then M represents a PE bipartite graph else it does not;
In the algorithm, we compute fi for 14 i G n by noticing that in the matrix Q = (qij) = MMT, there are exactly fi elements in row i which are equal to the diagonal element qii (qii itself is also counted). This follows since qij counts the number of columns in M which have a nonzero entry in both row i and row j while q ii is the sum of the ith row in M, hence qu = qii if and only if row j majorizes row i in M. The matrix Q is computed only once, and tlhen it is updated in 0(n2) operations after the elimination of each bisimplicial edge xiyj. This is done by subtracting one from each entry qrS such that mj X mj = 1 and then changing the ith row and column of Q to zero.
The wcrst case running time of this algorithm is 0(n3) since the while loop may be performed at most n times and each execution of the loop takes at most 0(n2) operations.
The Ar’gorithm
end
Example. Given the graph of Fig. 1, Y2
Y3
Y.4
M=x,:XI x,0
11 1
01
00,
x,0
0
1 1
1 1
YI
Let G(X U Y, E) be the input bipartite graph to be checked where 1X1= lYl = n and assume it is represented by the matrix M. For a matrix A, we denote by AU the matrix obtained by changing all entries in the ith row and jth column of A to zero and by AT the transpose of A. The Algorithm Let M = (mu) be the input matrix begin simplical -found + true compute the matrix Q = (qij) where Q = MMT; for j + 1 to n do Sj + Zr=, mij; while there exists an Sj 7” 0 and simplical_found
so x , y, is d bisimplicial edge (x 4y4 is also bisimplicial). After x, y, is eliminated the matrix D is computed,
do begi for i + 1 to R do let ei be the number of entries in ro\J i of
Q which are equal to q ii; if there exists a nonzero entry mu in M Iwhere s, f e, then
and
(Q -
D)li =
0
0
0
0
0 i 0
22
3 2 2
2’ 1i 21
10
1
begin
Compute the matrix D = (dk& where d ZZlYl~j*ll?lfj; Q -“(‘Q - ]D)ii; comment: Q is now equal to (M’ti)(Mili)T; for k + 1 to n do sk * s: co;
Sk -
mik;
and also M is updated to give 0
M=
0
0
o\
1 1 C 111’ c 01 i1 (1
01
NOM,Y2y2 is a bisimplicial edge since s2 = t’Z= 2.
end 4 181
Volume 15, Number 4
INFORMA-LION PROCESSING LETTERS
In this case,
counterparts of chordal graphs. A graph G of n vertices is a chordal graph if there exists a sequence of vertices v,, . . D,vn such that (1) v, is simplicial in G, i.e., Adj(v,) induces a complete subgraph in G, (2) vi is simplicial in G - [vi,. . . ,Vi _ ,]. The recognition algorithm in this paper used adjacency matrix methods similar to the algorithm of [l] for testing chordality of graphs. A linear time algorithm for chordality testing is given in [6], this algorithm uses lexicographic breadth first search. Although the problems of recognizing chordal graphs and PE bipartite graphs are related, it seems that the latter problem is more complicated since the ctmrination scheme involves
182
31 October 1952
checking conditions on edges rather than on vertices. Typically algorithms which involve checking such conditions require more than linear time. For example, the fastest known recognition algorithm for comparability graphs [3] which also involves checking edge conditions requires O(r?) steps in its worst case.
References (11F.
Gavril, An algorithm for testing chordality of graphs, Inform. Process. Lett. 3 (1974) 1IQ-1 12. PI MC. Golumbic and C.F. Goss, Perfect elimination and chordal bipartite graphs, J. Graph Theory 2 (1978) 155- 163. [31 M.C. Golumbic, Algorithmic Graph Theory and Perfect Graphs (Academic Press, New York, 1980). PI L. Haskins and D.J. Rose, Toward a characterization of perfect elimination digraphs, SIAM J. Comput. 2 (1973) 217-224. 151 D.J. Rleitman, A note on perfect elimination digraphs, SIAM J. Comput 3 (1974) 280-282. t61 D r- Rose, R.E. Tarjan and G.S. Leuker, Algorithmic aspects of vertex elimination on graphs, SIAM J. Comput. 5 (1976) 266-283.