13
Matchings and Walks in Graphs C. D. Godsil INSTITUT FUR MATHEMATIK UND ANGEWANDTE GEOMETRIE MONTANUNI VERSITAT LEOBEN, AUSTRIA ABSTRACT The matching polynomial a(G, x) of a graph G is a form of the generating function for the number of sets of k independent edges of G. In this paper we show that if G is a graph with vertex u then there is a tree T with vertex w such that This result has a number of consequences. Here we use it to prove that a(G \ Y, 1 /x)/xa(G, 1 /x) is the generating function for a certain class of walks in G. As an application of these results we then establish some new properties of a(G. x). 1. INTRODUCTION Let G be a graph with n vertices. A k-matching in G is a set of k edges, no two of which have a vertex in common. If p(G, k) denotes the number of k- matchings in G then the matchingpolynornial of G is li 1 a( G, X) = C (- 1 )kp( G, k)~"-~~, k= 0 where we assume p(G, 0) = 1. If G has adjacency matrix A then the characteristic polynomial @( G, x) of G is det(x1- A). The key result of this paper is that, given a graph G with a vertex Y, there is a tree T with a vertex w such that Journal of Graph Theory, Vol. 5 (1 981 ) 285-297 01 981 by John Wiley &Sons, Inc. CCCO364-9024/81/030285-13$01.30

Matchings and walks in graphs

Embed Size (px)

Citation preview

Page 1: Matchings and walks in graphs

Matchings and Walks in Graphs

C. D. Godsil INSTITUT FUR MATHEMATIK UND ANGEWANDTE GEOMETRIE

MONTANUNI VERSITAT LEOBEN, AUSTRIA

ABSTRACT

The matching polynomial a(G, x ) of a graph G is a form of the generating function for the number of sets of k independent edges of G. In this paper we show that if G is a graph with vertex u then there is a tree T with vertex w such that

This result has a number of consequences. Here we use it to prove that a(G \ Y, 1 / x ) /xa(G, 1 / x ) is the generating function for a certain class of walks in G. As an application of these results we then establish some new properties of a(G. x ) .

1. INTRODUCTION

Let G be a graph with n vertices. A k-matching in G is a set of k edges, no two of which have a vertex in common. If p(G, k ) denotes the number of k- matchings in G then the matchingpolynornial of G is

li 1 a( G, X ) = C (- 1 ) k p ( G, k ) ~ " - ~ ~ ,

k = 0

where we assume p(G, 0) = 1. If G has adjacency matrix A then the characteristic polynomial @( G, x) of G is det(x1- A ) .

The key result of this paper is that, given a graph G with a vertex Y, there is a tree T with a vertex w such that

Journal of Graph Theory, Vol. 5 ( 1 981 ) 285-297 0 1 981 by John Wiley &Sons, Inc. CCCO364-9024/81/030285-13$01.30

Page 2: Matchings and walks in graphs

286 JOURNAL OF GRAPH THEORY

The characteristic polynomial of a forest coincides with its matching polynomial (see [4]). Consequently many properties of a(G, x) can be established using ( 1), together with known results about the characteristic polynomials of graphs. For a detailed discussion along these lines, see [2].

A second aspect of (1) is that the right-hand side of it can be viewed as a form of the generating hnction for the closed walks in T which start at IY.

This observation enables us to prove that

x-' a( G \u,x-' )

a( G , x-'

is the generating function for a certain class of closed walks in G which start at u. This somewhat unexpected relation between walks and matchings does not appear to have been previously recognized.

We are able to use the above results to obtain further information about a(G, x). For example, we show that if G has n vertices then a(G, x) (and hence the number of 1-factors of G) is determined by the collection of subgraphs of G with [n/2] 4- 1 vertices.

2. THE MATCHING POLYNOMIAL AND T(G, v )

We begin by presenting two preliminary results which can be used to simplify the task of computing the matching polynomial of a graph. Their proofs may be found in [4] and [ 5 ] .

Lemma 2.1. Let G be a graph with a vertex u. Let H = G \ zi and let w,, . . . wh be the vertices in G adjacent to u. Then

Lemma 2.2. Suppose G is the disjoint union of the graphs K and L. Then

a ( G , x ) = a(K , x)a(L, x).

Definitions 2.3.

(a) A walk of length n in the graph G is a sequence

of vertices from G such that pi is adjacent to Pi+, for i = 0,. . . , n - 1. If Po = PI, then p is a closed walk. We regard a single element as a closed walk

Page 3: Matchings and walks in graphs

MATCHING AND WALKS 287

with length zero. If no vertex is visited twice by 8 (i.e., Pi = Pj implies i = j ) then we call 8 apath. We use 8, to denote the walk

( P o , . . . 9 Pm),

where m I n. Thus if 8 has length n , 8 = 8,7. (b) Let G be a graph with a vertex v . We define T(G, v ) to be the graph

which has as vertices the paths in G which start at v and where two such paths are adjacent if one is a maximal proper subpath of the other. (Thus if 8 is a path of length n in G which starts at v then the only path starting at v with length less than n which is adjacent to 8 is 8,1-, .) The single element path ( v ) in T( G, v ) will always be labeled v . We note that T( G, v ) depends only on the component of G containing v .

Our next result gives some important properties of T(G, v) .

Lemma 2.4. Let G be a graph with a vertex v. Then

(a) T(G, v ) is a tree. (b) If G is a tree, T(G, v ) G G. (c) If wI , . . . , wk are the vertices in G adjacent to v then T(G,u) can be

obtained from the forest

by adjoining a vertex v and defining it to be adjacent to each of the vertices w;(l l il k ) .

ProoJ We prove (b) and (c) first. If G is a tree then the map taking each vertex w in V(G) onto the unique path joining v to w provides the required isomorphism from G to T(G, v) .

The last statement follows directly from the definition of T(G, v ) . We leave the details to the reader.

The proof that T( G, v ) is a tree proceeds by induction on n , the number of vertices in G. When n 5 2 the claim follows from (b). If n > 2 we assume inductively that if w E G\ZJ then T(G\v, w) is a tree. It follows then from (c) that T(G, v ) is itself a tree.1

The next result provides our justification for introducing the tree T( G, v) .

Theorem 2.5. Let v be a vertex in the graph G. Then

and a( G, x ) divides a( T( G, v ) , x ) .

Page 4: Matchings and walks in graphs

288 JOURNAL OF GRAPH THEORY

Froo$ Suppose G has n vertices. If G is a tree the result follows by Lemma 2.4(b). Hence the theorem is true if n i 2. If n > 2 we assume inductively that the theorem is true for all graphs with less than n vertices. Set H = G\v and let wI , . . . , wh be the vertices in G adjacent to v. Then

(by 2.1).1

The matching polynomial of a tree coincides with its characteristic polynomial (see [4]). Hence the zeros of the matching polynomial of a tree are real. From Theorem 2.5 we conclude then that the zeros of the matching polynomial of any graph are real. For a more detailed discussion of this and some related matters, see [2].

3. TREELIKE W A L K S

In this section we establish a relation between the matching polynomial and a class of walks in G.

Definitions 3.1. A walk 6 of length n 1 2 in G will be said to repeat about i (0 < i < n ) if pi-, = pi+,. In this case we can obtain a new walk, y say, of length n - 2 from 6 by setting

We will say 2 is obtained from 6 by reduction at i.

If 6 does not repeat about any i then we call 6 an irreducible walk. Since the process of reduction always gives rise to a walk which is shorter than the original walk, it follows that we can always obtain an irreducible walk from a given walk in a finite number of steps. In particular, we can always obtain an irreducible walk from 6 by a finite number of reductions, each of which is carried out at the lowest possible value of i. The resulting walk will be denoted by $.

Page 5: Matchings and walks in graphs

MATCHING AND WALKS 289

Our next result shows that any two irreducible walks obtained from a given walk are identical.

Lemma 3.2. Suppose (y is obtained from the walk 1 by a sequence of reductions. Then = $.

Proof. It will suffice to consider the case where cy is derived from by a single reduction, because the general case follows from this by a trivial induction argument.

Suppose @ has length n. If n I 2 there is nothing to prove. Accordingly we assume n > 2 and that the result holds for all walks with length less than n. Let the walk a be obtained from e by reduction at i and let j be the least positive integer such that e is reducible a t j . Clearly j I i.

If j = i, then ‘y = ,@ by definition. Consequently we assume j < i. If j < i - 1 then ‘y repeats aboutj. Suppose that by reducing both ‘y and a t j we obtain walks y and !, respectively. Then y can be derived from ! by reduction at i - 2 and so, by our induction hypothesis,

Since i is the least index about which ,@ repeats we also have i= $. Therefore 6 = f i as claimed.

repeats about i - 1 and i. Thus we must have

Suppose now that j = i - 1. Then

for suitable distinct vertices u, v in G. It follows that the walk obtained from ,@ by reduction a t j = i - 1 is just ‘y. As i - 1 is the least index about which e repeats, it follows that $ = 5 . B Definition 3.3. If ,@ is a walk in G with length n such that $,, is a path for each m, (0 I m I n) , then we call .@ a treelike walk.

We note that if ,@ is both closed and treelike, then ,@ is just a single vertex. However if is a walk in G and f i is a single vertex it does not follow that is treelike. For example, if

is a walk in G then

basic information about treelike walks.

= (v), but ,@ is not treelike. The next result justifies our choice of notation, as well as providing some

Lemma 3.4. The following statements about a graph G are equivalent:

Page 6: Matchings and walks in graphs

290 JOURNAL OF GRAPH THEORY

(a) G is a forest (b) each walk in G is treelike (c) each closed walk in G is treelike.

h o $ Clearly (b) implies (c). I f (a) is false then G contains a circuit vo, 4,. . . , v,, where v; is adjacent to vi+l (0 l i I n) and v,, is adjacent to vo. The walk defined by setting

vi, O I i l n

vo, i = n - 1 Bi =

is then an irreducible closed walk in G which is not a path. Consequently (c) implies (a).

It remains to show that (a) implies (b). Let f i be a walk of length n in the forest G and let B denote the subgraph of G induced by the vertices Bi(O I i I n). Since G is a forest and B is connected, B is a tree. I fB is a path then it is easy to show that 6 is a path. I fB is not a path it must have at least three endvertices. In this case it is not difficult to show that there is an index i, 0 < i < n, such that Pi is an endvertex in B. Consequently ,@ repeats about i.

Therefore if B is not a path, ,@ is reducible. We conclude that if B is irreducible then B is a path. Hence 8 is always a path, and so each walk in G is treelike.1

In view of the proof of 3.4 it is worth remarking that ifg is a treelike walk of length n in the graph G and G is not a tree, then the subgraph induced by the vertices Pi, 0 5 i 5 n, need not be a tree. For example, if

is a walk op G it is a treelike walk, even though the subgraph induced by the vertices in contains a cycle.

Theorem 3;s. Let G be a graph with a vertex v . Then there is a bijection between the set of walks in T(G, v ) starting at v and the set of treelike walks in G starting at v. This bijection maps closed walks onto closed walks and preserves walk length.

Prooj: Let sr be a walk of length n in T(G, v ) starting at v . We associate to ? a sequence =An) of vertices in G by defining pi, 0 5 i I n, to be the endvertex of the path in G corresponding to T,. We claim thatfis the bijection we need.

We show first that 6 is actually a walk of length n in G. If i is an integer, 0 5 i < 1 2 . one of the paths in G corresponding to the vertices T, and q+l is a

Page 7: Matchings and walks in graphs

MATCHING AND WALKS 291

maximal proper subpath of the other. Consequently the endvertices of these paths are adjacent, which implies that pi and are adjacent. Therefore p is a walk of length n in G.

We note that if, for some i, q = v then pi = v. Hence ,@ =A?) starts at v and is closed if? is. Thusfsatisfies the second claim in the statement of the theorem.

We prove now that f is an injection. Suppose ,K and $ are distinct walks in T(G, v ) which start at v. Let @ =A?), y = A$). We assume that @ = 1 and show in consequence that ? = 9, a contradiction.

Let i be the least non-negative integer such that ri = k. This integer exists, since ? # $. Also, as no = rt0 = v , i 1 1. By our choice of i, ri-l = 16;.-, , and since 8 = y, pi = yi. Hence, Ti and $[ are two walks of length i in G which start at v, have a common maximal proper subwalk, and the same endver- tices. Therefore they are equal and so it follows that ? = $. Thus, f is an injection.

is a walk in T(G, v ) starting at v and @ =AT) then@ =A@). Suppose and F ~ + ~ have the same endvertex. As these paths are both adjacent to Fi, it follows that these are equal. On the other hand, if repeats about i then so must p. Consequently ? repeats about i if and only if @ does.

Suppose then that ? repeats about i. Then 8 repeats about i and if$, y are derived from ?, @, respectively, by reduction at i, then y =A$). By induction on the length of? we conclude thatAn) can be derived from 6 by a series of reductions. By the previous paragraphA@) is irreducible and so, by Lemma 3.2,Ag) = 6.

We can now prove that @ is a treelike walk in G. Since T(G, v ) is a tree, ? is treelike by Lemma 3.4. Hence, is a path. To provet is treelike we must demonstrate that i ) =An) is a path. Let $ = @.

is a maximal proper subpath of $;, 1 i i 5 n. If is also a maximal proper subpath of 9, then = which is impossible since $ is a path in T(G, v ) . As $; and are adjacent we conclude that must be a maximal proper subpath of Using a simple induction argument on the length of $=@we find that,given i a n d j such that 0 5 i < j l n, $; is a proper subpath of &. Consequently the paths in G corresponding to 9; and % have distinct endvertices and so it follows that the vertices in @ are all distinct. Thus, 6 is a path.

We have shown, then. thatfis an injection from the set of paths in T(G, u ) starting at t i into the set of treelike walks in G starting at v. We complete the proof by showing that it is a surjection.

k t fI’ be a treelike walk of length n 1 1 in G which starts at u. Let y = p,,-l. We claim that one of 7, ,@ is a maximal proper subpath of the other.

Suppose that the length o f f is m. We define the sequence 6 of length ?n + 1 by setting

Our next step is to show that if repeats about i. Then

Obviously Po is a maximal proper subpath of 9,. Suppose

Page 8: Matchings and walks in graphs

292 JOURNAL OF GRAPH THEORY

We see that _s can be obtained by a series of reductions from 6 and so is a treelike walk in G starting at v . We also have _s = E .

= ,@ and _r are both paths. If _s itself is a path then 5 = is a maximal proper subpath of $. If! is not a path then, since it is a treelike walk, it must repeat about some index i. Since _r is &reducible, it therefore repeats about m, but no other vertex. Consequently _s = a,,--, is a maximal proper subpath of j .

If] is a treelike walk of length n in G starting at v we therefore define a sequence

AS fi is treelike, = $ and so

of paths in G by setting

?Ti = g j (0 I i I n ) .

This sequence has the property that rr, = v and that for each i, 0 5 i < y1 - 1, rj is a maximal proper subpath of T,,~, or vice versa. Accordingly we may regard p as a walk in T(G, v ) which starts at v .

Since $I and 6, have the same end-vertices we also find thatfl?) = e . Hence we have now shown thatfis a surjection from the walks in T(G, v ) starting at v onto the set of treelike walks in G starting at v . This completes the pro0f.D

Our next result provides a relation between the matchings and treelike walks in G.

Theorem 3.6. Let G be a graph with vertex v. Then

which start at u is (a) the generating function for the number of closed treelike walks in G

(b) the generating function for the number of closed treelike walks in G is

where a’(H, y ) = (d/dy)cr(H, y ) , for a given graph H.

ProoJ: As already noted, the matching and characteristic polynomials of a tree are equal and so, by Lemma 2.1 of [3] (for example),

Page 9: Matchings and walks in graphs

MATCHING AND WALKS 293

is the generating function for the closed walks in T( G, u ) which start at u. Thus (a) follows at once from Theorems 2.5 and 3.5. The generating function for all closed tree-like walks in G is the sum of the generating functions for the closed treelike walks starting at a given vertex. However, we know from [ 5 ] that

and so (b) follows from (a).l

4. RECONSTRUCTION

Tutte has shown, in [8, 56.91, that the number of l-factors of a graph G is reconstructible, i.e., is determined by the collection of vertex-deleted subgraphs of G. From this result it is possible to show that a(G, x) is reconstructible. Surprisingly, we can prove a stronger result.

Theorem 4.1. Let G be a graph with n vertices. Then a(G, x) is determined by the collection of induced subgraphs of G with [$] + 1 vertices.

Pro05 Let d, denote the number of closed treelike walks in G with length m. Let A,, . . . , A,, be the roots of a(G, x). From 3.6(b) we see that

This implies that the roots of a(G, x) can be determined using Newton’s relations from the sequence do,. . . , dn-,.

We now demonstrate how this sequence may be determined from the information given. If H is an induced subgraph of G, let di,b(H) denote the number of closed treelike walks f in H with the property that the subgraph induced by the vertices in f has just b vertices. We refer to b as the order of

Counting in two ways the pairs (p, H), where H i s an induced subgraph of G with h vertices and - p is a closed?reelike walk in H with length i and order b 5 h, we find that

P.

(This argument is just a case of “Kelly’s lemma.” see 171.) Therefore we can complete the proof by showing that a closed tree-like

walk of length n has order at most [1] f 1. For then. applying (4 j with H =

Page 10: Matchings and walks in graphs

294 JOURNAL OF GRAPH THEORY

[$] + 1, we conclude that d,,b(G) is determined by the given collection of subgraphs for all b F h. Hence

h

d; = Z d;,b(G) b = I

is also so determined. By our earlier remarks this implies the theorem. Let P be a closed treelike walk with length rn in G. Since reduction at a

given kdex gives rise to a walk of length m - 2 and order at most one less than the order p, our claim follows by a simple induction argument. (Note here that a walk of length zero has order one.)l

5. PATHS IN G AND a(G. x )

Heilmann and Lieb have noted in [ 6 ] that if G has a Hamiltonian path then the roots of a(G, x) are distinct. In this section we derive a strengthening of the old result that the number of distinct roots of @( G, x) is greater than the diameter of G (see, for example, Corollary 2.7 in [ 11). We then use this to provide a stronger form of the result of Heilmann and Lieb.

Definitions 5.1. If v and w are vertices in the graph G, we use d(v, w) to denote the distance between them. We define the eccentricity of v in G to be

e(v, G) = max(d(v, w j ) l w E G).

The maximum value of e(v, G), as v ranges over the vertices of G, is the diameter of G.

Theorem 5.2. Let G be a graph with a vertex v. Then the poles of

are simple, and there are at least e(v, G) + 1 of them

Boo$ Let A be the adjacency matrix of G. Assume G has i z vertices and is labeled so that the first row ofA corresponds to v. Let u be the vector in R" with first co-ordinate u, = 1 and all other co-ordinates zero. Let 7.J denote the subspace of K' spanned by the vectors A"u(r = 0, 1, . . . ).

Set e = e(v, G). Then for i, j ( 0 5 i < j 5 e) we see that there is a co- ordinate on which A'u is zero but AJu is not-any co-ordinate corresponding to a vertex w in G such that i < d(v, w) 5 j will do. Consequently the vectors A'u(r = 0, 1,. . . , e) are linearly independent. Therefore dim U, the dimen-

Page 11: Matchings and walks in graphs

MATCHING AND WALKS 295

sion of U, is greater than e -I- 1. We complete the proof of the theorem by showing that the number of distinct poles of @( G \ u, x)l@( G, x ) equals dim U.

Since A is a symmetric matrix it has a complete set of (right) eigenvectors zl,. . . , z, which form an orthonormal basis for R". If A has an eigenspace with dimension greater than one we choose the eigenvectors from this space so that at most one is not orthogonal to u. Thus, we may assume there is an integer d with 1 I d I n such that <u, zi> = 0 if and only if d < i I n and that the eigenvectors z, , . . . , zd correspond to distinct eigenvalues of A .

Hence we have d

I = I u = C < U , Z j > Z i

and so, for r = 0, 1 ,..., d

I = 1 A'u = c < u, zi > zi

It follows that dim U I d . Further the eigenvalues A,, . . . , X, are distinct and so the Vandermonde matrix with ij-entry A{ is nonsingular. Since the vectors <u, zi>zi are linearly independent it follows from this and ( 1 ) that the vectors A'u(r = 0,. . . ,d - 1) are linearly independent. Thus dim U l d and so dim U = d .

From (1) we also have

I = d d < u, z;>* x < u, A'u > xr = c. x (XX,) ' < u, z; > 2 = c . (2 )

r = O r = O i = I i =1 1 - x X ,

Now <u, Aru> equals the number of closed walks of length r in G starting at u. Hence the left-hand side of (1) is the generating function for the closed walks in G starting at u. By Lemma 2.1 of [3], we see that this generating function equals

Taking this with (2), we thus find that

The left-side of ( 3 ) clearly has exactly d poles, each of which is simple. Since d = dim U 2 e + 1, the theorem is proved. I

Page 12: Matchings and walks in graphs

296 J O U R N A L OF GRAPH THEORY

We note that the well known result that the roots of @(G\ u, x) interlace those of @(G, x) is an immediate corollary of 5.2. It also follows, since a graph G always has a vertex u such that e(u, G) equals the diameter of G, that @(G, x) has at least d + 1 distinct roots.

We now apply 5.2 to the matching polynomial.

Corollary 5.3. Suppose that the longest path in G has length h. Then a( G, x) has at least h + 1 distinct roots. In particular if G has a Hamiltonian path then the roots of a(G, x) are all distinct.

Proof. Let e = e(r, T(G, r)). By 5.2 we see that

has only simple poles, and at least e + 1 of them. By 2.5 the same is true for a(G \ v , x ) / a ( G, x). Hence a( G, x) has at least e + 1 distinct roots. From the definition of T(G, v ) we see that e equals the length of the longest path in G starting at u. Choosing u so that this length is as large as possible yields the result claimed. I

We note that Corollary 5.3 can also be obtained using the methods of Heilmann and Lieb [6 J.

ACKNOWLEDGMENT

I would like to thank Brendan D. McKay for many useful discussions on the topics in this paper and for his constructive criticisms of the first draft of this manuscript.

References

[ 11 N. Biggs, AZgebraic Graph Theory, Cambridge Tracts in Mathematics No. 67. Cambridge U. P., London (1974).

[2] C . D. Godsil and I. Gutman, On the theory of the matching polynomial. J. Graph Theory. To appear.

[3] C. D. Godsil and B. D. McKay, Spectral conditions for the reconstructibility of a graph. J. Combinatorial Theory Ser. B. To appear.

[4] I. Gutman, The acyclic polynomial of a graph. Pub1 Inst. Math. (Beograd) 22( 1977) 63-69.

[5 J I. Gutman and H. Hosoya, On the calculation of the acyclic polynomial Theoret. Chim. Acta. 48 (197P) 279-286.

Page 13: Matchings and walks in graphs

MATCHING AND WALKS 297

[6] 0. J. Heilmann and E. H. Lieb, Theory of monomer-dimer systems.

[7] P. J. Kelly, A congruence theorem for trees. Pacific J. Math. 7 (1957)

[8] W. T. Tutte, All the king’s horses. In Graph Theoly and Related Topics. Edited by J. A. Bondy and U. S . R. Murty. Academic, New York (1979)

Comm. Math. Physics 25 (1 972) 190-232.

961-968.

pp. 15-33.