Realizing the distance matrix of a graph...Title Realizing the distance matrix of a graph Author...

2
------ ---- ----_ .. _- ._-_. JOURNAL OF RESEARCH of the National Bureau of Standards - B. Mathematics and Mathematical Physics Vol. 70B, No.2 , April - June 1966 Realizing the Distance Matrix of a Graph A. J. Goldman Institute for Basic Standards, National Bureau of Standards, Washington, D.C. (Fe bruar y 23, 1966) An explicit d es cription is giv en for the uniqu e graph with as few ar cs (each b ea rin g a positive length) as possibl e, whi c h h as a pre sc rib ed mat ri x of s hort est -path dis tan ces betwee n pa irs of distinct vertice s. Th e s am e is done in th e case wh en the ith dia gonal matrix e ntr y, in ste ad of be ing zero , represents the. length of a sho rt est c lo sed path co ntainin g th e ith ver tex. Key Words: Graph, di stance matrix, s hort es t path. Let G be a finite oriented graph with verti ces where n > 2. To avoid unn ecessa ry compli ca tions, we r es trict attention to connect ed graph s, i. e., if i r!= j then G co ntain s a dir ec ted path from Vi to Vj . As additional struc tur e, we assume associated to G a positive-valued func ti on lc ass igning leng ths lc(i, j) to the arcs (Vi, Vj) of G. The dist ance matrix Dc of G ha s entri es dc;(i , i) = ° on the main dia go nal; a typical off-diagonal entry dc(i, J) repersents the length of a s hort es t directed path in G from Vi to Vj . An ar c of G is called redundant if its deletion leave s Dc unc hanged. Th e gra ph G will be called irreducible if it contains no re dundant arcs. A real square matrix D with entri es d(i , j) is called realizable if there is a gr ap h G such that D = Dr;. Hakimi and Yau t showed that necess ary and s uffi cient conditions for the realizability of Dar e d(i, i) = 0, d(i , J} > ° if i r!= j, d(i, J) d(i, k) + d(k, j). (1) (2) (3) The neces sity of the se conditions should be clear. To prove sufficiency one nee d only take th e ar cs of G to be all (Vi. Vj) with i r!= j, and define le by le/i, J) = d(i , j) ; it follows readily from (1) to (3) that Dc= D. If matrix D is realizabl e, it clearly ha s a realization by an irreducible graph. Hakimi and Yau (o p. cit.) showed that this irre du cible representation was unique , but did not give an explicit d escription of it. Our first purpose in this not e is to provide such a d es cription. THEOREM 1. Let G be an irreducibl e representation ofD . Arc (Vi> Vj) is present in G if and only ifi r!= j and d(i, j) < min {d(i, k) + d(k, j) : k r!= i, j}. (4) I S. L. Hakimi and S. S. Yau, Distance matrix of a grap h and it s rea lizabilit y, Q. Applied Ma th ., Jan. 1965,305- 31 7. In this case, ldi, j) = d(i, j ). (5) We re mark that it follows that G c an be c onstru cted (s imultan eously with the chec kin g of (3)) in th e follow- ing way. Re place the zeros on the main dia go nal of D by 00, ob taining a new matrix E = (ei) ' Form £2 = (e;J») using the spec ial " matrix multipli ca ti on" often employed for s hort est -p at h problem s, i.e., e;]) = min (e ik + ekJ k (D. Ro se nblatt ha s point ed out the relation of this operation to th e Peir ce -S c hroder relative s um ; see e.g., B. Ru sse ll's " Principles of Mathemati cs . ") In vi ew of (3) .and (4), arc (Vi, Vj ) is pre se nt in G if and only if i r!= j and eij r!= eIJ); if pr ese n t, its length is gi ven by (5). We begin the proof by obs erving that G, beca use of its irreducibility, contains no ar cs of th e for m (Vi, Vi). Thus arc (Vi, Vj) can be pres e nt in C only if i r!= j. If ar c (Vi, Vj) is present in G, it cons titut es a path from Vi to Vj, and so lc(i , J) dc(i , J) = d(i , J). (6) If strict inequality held in (6), then th ere would be a s hort e st path P ij from Vi to Vj (in G) which d oes not co ntain (V i, Vj), and no path of C would be le ngth e ned if eac h appearanc e of (V i , Vj) in it were re placed by P ij . Th e refore (Vi, vJ wo uld be redundant, a contra- diction. So (5) is proved. Suppose (4) does not hold, i.e., there is a k r!= i, j such that dc;(i , j) = d(i, J) d(i, k) + d(k, J) = dc;(i, k) + dc(k , J}. (7) Let P ik be a shortest path in G from Vi to Vh' , Phj a shortest path from Vk to Vj, and Qij the composition of P ik and P kj . If arc (Vi , Vj) were present in G, then by (2), (5) and (7) it co uld not lie in Pik or Pkj , and hence not in Qu. It follows from (5) and (7) that no path in 153

Transcript of Realizing the distance matrix of a graph...Title Realizing the distance matrix of a graph Author...

--------------_ .. _- ._-_.

JOURNAL OF RESEARCH of the National Bureau of Standards - B. Mathematics and Mathematical Physics

Vol. 70B, No.2, April - June 1966

Realizing the Distance Matrix of a Graph

A. J. Goldman

Institute for Basic Standards, National Bureau of Standards, Washington, D.C.

(February 23, 1966)

An explicit description is give n for the unique graph with as few arcs (eac h bearing a positive length) as poss ible, which has a prescribed mat rix of shortest-path di stan ces be tween pa irs of distinct vertices . The same is done in the case when the ith diagonal matrix e ntry, in s tead o f be ing zero , represents the. length of a s hort est c losed path containing the ith vertex .

Key Word s: Graph, di s ta nce matrix , shortes t path.

Le t G be a finite oriented graph with vertices {Vi}~', where n > 2. To avoid unnecessary complications, we res tric t attention to connected graphs, i. e., if i r!= j then G contains a directed path from Vi to Vj . As add itional s tru cture, we assume associated to G a positive -valued fun ction lc ass igning lengths lc(i, j ) to the arcs (Vi, Vj) of G.

The distance matrix Dc of G has e ntries dc;(i , i) = ° on th e main diago nal ; a typical off-diagonal e ntry dc(i, J) re perse nts the le ngth of a shortes t directed path in G from Vi to Vj. An arc of G is called redundant if its deletion leaves Dc unchanged. The graph G will be called irreducible if it contain s no redundant arcs.

A real square matrix D with entri es d(i , j ) is called realizable if there is a grap h G s uc h that D = Dr;. Hakimi and Yau t showed that necessary and s uffi cie nt conditions for the realizability of Dare

d(i, i) = 0,

d(i , J} > ° if i r!= j ,

d(i, J) ~ d(i, k) + d(k, j).

(1)

(2)

(3)

The necessity of these conditions should be clear. To prove sufficiency one need only take the arcs of G to be all (Vi. Vj) with i r!= j , and define le by le/i, J) = d(i , j) ; it follows readily from (1) to (3) that Dc= D.

If matrix D is realizable, it clearly has a realization by an irreducible graph. Hakimi and Yau (op. cit. ) showed that this irreducible representation was unique , but did not give an explicit description of it. Our first purpose in thi s note is to provide suc h a description.

THEOREM 1. Let G be an irreducible representation ofD. Arc (Vi> Vj) is present in G if and only ifi r!= j and

d(i, j) < min {d(i, k) + d(k, j) : k r!= i, j}. (4)

I S. L. Hakimi and S . S. Yau, Distance matrix of a graph and its rea lizabilit y, Q. Applied Math ., Jan . 1965,305- 31 7.

In this case,

ld i, j ) = d(i, j ). (5)

We re mark that it follows that G can be construc ted (simultaneously with the c hec king of (3)) in the follow­ing way. Replace the zeros on the main diagonal of D by 00, obtaining a new matrix E = (ei) ' Form £2 = (e;J») using the special " m a trix multiplication" often e mployed for shortest-path problems, i. e .,

e;]) = min (e ik + ekJ k

(D. Rosenblatt has pointed out the relation of thi s operation to the P eirce-Schroder relative s um ; see e.g., B. Russell' s " Principles of Mathematics .") In view of (3) .and (4), arc (Vi, Vj) is prese nt in G if and only if i r!= j and eij r!= eIJ); if presen t, its length is gi ven by (5).

We begin the proof by observing that G, because of its irreducibility, contains n o arcs of the form (Vi, Vi).

Thus arc (Vi, Vj) can be prese nt in C only if i r!= j. If arc (Vi, Vj) is present in G, it constitutes a path from

Vi to Vj, and so

lc(i , J) ~ dc(i , J) = d(i , J). (6)

If strict inequality held in (6), then there would be a shortest path Pij from Vi to Vj (in G) which does not contain (V i , Vj), and no path of C would be lengthe ned if each appearance of (V i , Vj) in it were replaced by Pij. Therefore (Vi, vJ would be redundant, a contra­diction. So (5) is proved.

Suppose (4) does not hold, i.e., there is a k r!= i, j such that

dc;(i , j ) = d(i, J) ~ d(i, k) + d(k, J) = dc;(i, k) + dc(k , J}. (7)

Let P ik be a shortest path in G from Vi to Vh' , Phj a shortest path from Vk to Vj, and Qij the composition of P ik and Pkj. If arc (Vi , Vj) were present in G, then by (2), (5) and (7) it could not lie in Pik or Pkj, and hence not in Qu. It follows from (5) and (7) that no path in

153

G would be lengthened if each appearance of (Vi, Vj) in it were replaced by Qu. Thus (Vi, Vj) would be re­dundant, a contradiction. We have proved that (4) is a necessary condition for the presence of (Vi, Vj)

in G. It only remains to rule out the possibility that (4)

holds but arc (Vi, Vj) is abse nt from G. Let the suc­cessive vertices of a shortest path in G from Vi to Vj

be Vi, Vk(l), .•• , Vk(m), Vj where m ~ 1 (because (Vi, Vj)

is absent). Then by (5),

dei , J) = dc(i , J) = d(i , k(l)) + ... + d(k(m)J). (8)

Repeated application of the triangle inequality (3) to the sum in (8) yields

dei, j) ~ dei, k(l)) + d(k(1), j),

contradicting (4). This completes the proof of the theorem.

COROLLARY. A graph G is irreducible if and only if, for each of its arcs (Vi> Vj),

leCi, j)= deCi, j) < min {deCi, k)+ deCk, j): k ¥= i, j}. (9)

We pass now to a second type of "distance matrix," denoted D'[; = (d*(i, J)), obtained from D by changing the main diagonal's entries from da(i, i) = 0 to d'[;(i , i), the length of a shortest closed path of G which con­tains Vi.

THEOREM 2. A matrix D* is realizable as a D~ if and only if its entries d*(i, j) satisfy

d*(i, j) > 0,

d*(i, j) ";;; d*(i , k)+ d*(k, j),

d*(i, i) ";;; min {d*(i, j)+d*(j, i):j ¥= i}.

(10)

(11)

(12)

The necessity of (10) and (11) should be clear. As for (12), observe that any closed path C of G contain­ing Vi and at least one other vertex can be regarded as consisting of a path from Vi to some other vertex Vj of C, followed by a path from Vj back to Vi; the min­imum possible lengths of these two paths are dW, J} and d'[;(j, i), respectively. Thus the shortest closed path containing Vi and Vj (j ¥= i) has length d,[;(i, J) + d'[;(j, i), and so

d'[;(i, i) ,,;;; min {d'[;(i, J) + dW, i):j ¥= i}, (13)

from which the necessity of (12) follows. Note that equality holds in (13) unless (Vi, Vi)eG. (If our def­inition of "graph" were restricted to exclude arcs of the form (Vi, Vi), then equality would hold in (12).)

The sufficiency proof is as for Dc, except that the realizing graph is given an arc (Vi, Vi) for each index i such that strict inequality holds in (12).

We now assume the definitions of "redundant" and "irreducible" modified to apply to D'[; rather than Dc. The analog of theorem 1 requires no new arguments. The conclusion is that if D* can be realized as a D'J, it has a unique irreducible realization, whose graph G is found as follows. Change the main diagonal terms of D* to zero, obtaining a matrix D satisfying (1) to (3). We have previously described how to construct the unique irreducible graph H such that-DH = D. Adjoin to H an arc (Vi, Vi) for each i such that strict inequality holds in (12), and let the length of this arc be d*(i, i).

(Paper 70B2-176)

154