Wilkins - Graph Theory - 2BA1s10_0607

  • Upload
    -

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    1/25

    Course 2BA1: Hilary Term 2007

    Section 10: Graph Theory

    David R. Wilkins

    Copyright c David R. Wilkins 2000-2007

    Contents

    10 Graph Theory 2

    10.1 U ndirected Graphs . . . . . . . . . . . . . . . . . . . . . . . . 210.2 Incidence and Adjacency . . . . . . . . . . . . . . . . . . . . . 310.3 Incidence and Adjacency Tables and Matrices . . . . . . . . . 410.4 C omplete Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 610.5 B ipartite Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 6

    10.6 Isomorphism of Graphs . . . . . . . . . . . . . . . . . . . . . . 710.7 Subgraphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 710.8 Vertex Degrees . . . . . . . . . . . . . . . . . . . . . . . . . . 810.9 Walks, Trails and Paths . . . . . . . . . . . . . . . . . . . . . 910.10Connected Graphs . . . . . . . . . . . . . . . . . . . . . . . . 1010.11The Components of a Graph . . . . . . . . . . . . . . . . . . . 1010.12Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1310.13Eulerian Trails and Circuits . . . . . . . . . . . . . . . . . . . 1410.14Hamiltonian Paths and Circuits . . . . . . . . . . . . . . . . . 2010.15Forests and Trees . . . . . . . . . . . . . . . . . . . . . . . . . 2010.16Spanning Trees . . . . . . . . . . . . . . . . . . . . . . . . . . 23

    10.17Directed Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . 2410.18Adjacency Matrices of Directed Graphs . . . . . . . . . . . . . 2410.19Directed Graphs and Binary Relations . . . . . . . . . . . . . 25

    1

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    2/25

    10 Graph Theory

    10.1 Undirected Graphs

    An undirected graph can be thought of as consisting of a finite set V of points,referred to as the vertices of the graph, together with a finite set E of edges,where each edge joins two distinct vertices of the graph.

    We now proceed to formulate the definition of an undirected graph insomewhat more formal language.

    Let V be a set. We denote by V2 the set consisting of all subsets of Vwith exactly two elements. Thus, for any set V,

    V2 = {A PV : |A| = 2},

    where PV denotes the power set of V (i.e., the set consisting of all subsetsof V), and |A| denotes the number of elements in a subset A of V.

    Definition An undirected graph (V, E) consists of a finite set V togetherwith a subset E of V2 (where V2 is the set consisting of all subsets of V withexactly two elements). The elements of V are the vertices of the graph; theelements of E are the edges of the graph.

    Example Let a, b and c label the three vertices of a triangle in the plane.Then there is an undirected graph (V, E) which consists of the vertices andedges of this triangle.

    a b

    c

    Here

    V = {a,b,c};

    E = {{a, b}, {b, c}, {c, a}}.

    Example Let a, b, c and d label the four vertices of a square in the plane(labelled in cyclic order around the square). Then there is an undirectedgraph (V, E) which consists of the vertices and edges of this square.

    2

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    3/25

    a b

    cd

    Here

    V = {a,b,c,d};

    E = {{a, b}, {b, c}, {c, d}, {d, a}}.

    Note that, in this example, not every subset of V2 with exactly two elementsis an edge of the graph. (Indeed the diagonals {a, c} and {b, d} are not edgesof this graph.)

    Let (V, E) be an undirected graph. In order to simplify notation, weshall often denote by a b an edge {a, b} of the graph whose endpoints are thevertices a and b.

    Definition A graph is said to be trivial if it consists of a single vertex.

    We may denote a graph by a single letter such as G. Writing G = (V, E)indicates that V is the set of vertices and E is the set of edges of somegraph G.

    10.2 Incidence and Adjacency

    Definition If v is a vertex of some graph, if e is an edge of the graph, andif e = v v for some vertex v of the graph, then the vertex v is said to beincident to the edge e, and the edge e is said to be incident to the vertex v.

    (We see therefore that an edge of a graph is incident to a vertex of thegraph, and the vertex is incident to the edge, if and only if the vertex is oneof the endpoints of the edge.)

    Definition Two distinct vertices v and v of a graph (V, E) are said to beadjacent if and only if v v E.

    (We see therefore that two distinct vertices of a graph are adjacent if andonly if they are the endpoints of an edge of the graph.)

    3

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    4/25

    10.3 Incidence and Adjacency Tables and Matrices

    The following example illustrates how we may associate incidence and adja-cency tables or matrices with graphs.

    Example Let a, b, c and d represent the four vertices of a square in theplane, and consider the graph consisting of the vertices and edges of thissquare. Let s, t, u and v denote the four edges of the square, where s = a b,t = b c, u = c d and v = d a.

    a b

    cd

    s

    t

    u

    v

    The incidence relations between the vertices a, b, c and d and the edgess, t, u and v can be expressed by the following table:

    s t u v

    a 1 0 0 1b 1 1 0 0c 0 1 1 0d 0 0 1 1

    Such a table is known as the incidence table for the graph.If a vertex is incident to an edge then the corresponding entry in the table

    has the value 1; otherwise that entry has the value 0.If the vertices are ordered (as first vertex, second vertex, etc.) and if the

    edges are also ordered, then this information may be encoded in a matrix,

    known as an incidence matrix. In this example, if the vertices are orderedas a,b,c,d (so that a is the first vertex, b is the second vertex, c is the thirdvertex, and d is the fourth vertex), and if the edges are ordered as s,t,u,v,then the corresponding incidence matrix is

    1 0 0 11 1 0 00 1 1 00 0 1 1

    .

    4

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    5/25

    Definition Let (V, E) be a graph with m vertices and n edges. Let the ver-

    tices be ordered as v1, v2, . . . , vm, and let the edges be ordered as e1, e2, . . . , en.The incidence matrix for such a graph then takes the form

    a11 a12 . . . a1na21 a22 . . . a2n

    ......

    ...am1 am2 . . . amn

    ,

    where the entry aij in the ith row and jth column has the value 1 if the ithvertex is incident to the jth edge, but has the value 0 otherwise.

    One may introduce in a similar fashion the adjacency table and the adja-cency matrix of a graph.

    Definition Let (V, E) be a graph with m vertices, and let the vertices beordered as v1, v2, . . . , vm. The adjacency matrix for such a graph then takesthe form

    b11 b12 . . . b1mb21 b22 . . . b2m

    ......

    . . ....

    bm1 am2 . . . bmm

    ,

    where the entry bij in the ith row and jth column has the value 1 if the ithvertex is adjacent to the jth vertex but has the value 0 otherwise.

    Note that the adjacency matrix of any (undirected) graph is symmetric:bij = bji for all indices i and j, where bij denotes the entry in the ith rowand jth column of the adjacency matrix.

    Example Consider the graph consisting of the vertices and edges of a squarein the plane. Suppose that the vertices are ordered in anticlockwise order

    around the square, starting from some chosen vertex of the square.

    1 2

    34

    5

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    6/25

    Then the adjacency matrix for this graph is the matrix

    0 1 0 11 0 1 00 1 0 11 0 1 0

    .

    10.4 Complete Graphs

    Definition A graph (V, E) is said to be complete if and only if, {v, v} Efor all v V and v V satisfying v = v.

    (Thus a graph is complete if and only if any two distinct vertices of thegraph are the endpoints of an edge of the graph.)

    A complete graph with n vertices is denoted by Kn.

    10.5 Bipartite Graphs

    Definition A graph (V, E) is said to be bipartite if there exist subsets V1and V2, such that

    (i) V1 V2 = V;

    (ii) V1 V2 = ;

    (iii) each edge in E is of the form {v, w} with v V1 and w V2.

    If in addition {v, w} is an edge of the graph for every v V1 and w V2 thenthe graph (V, E) is said to be a complete bipartite graph. In the case whenV1 has p elements and V2 has q elements, such a complete bipartite graph isdenoted by Kp,q.

    Example Let (V, E) be a graph with

    V = {a, b, c, d, e},E = {a c , a d , a e, b c, b d, b e}.

    Let V1 = {a, b} and V2 = {c, d, e}. Then the conditions in the abovedefinition are satisfied by the graph (V, E) and the subsets V1 and V2, andtherefore the graph is bipartite. Moreover it is a complete bipartite graph.

    6

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    7/25

    a

    b

    c

    d

    e

    V1

    V2

    10.6 Isomorphism of Graphs

    Definition An isomorphism between two graphs (V, E) and (V, E) is abijective function : V V with the following property: for any two distinctvertices a and b belonging to V, {a, b} E if and only if {(a), (b)} E.If there exists such an isomorphism : V V between two graphs (V, E)

    and (V, E) then these graphs are said to be isomorphic.

    We recall that a function : V V is bijective if and only if it has a well-defined inverse 1: V V. Thus a bijection : V V sets up a one-to-onecorrespondence between the vertices of V and V: to every vertex of V therecorresponds a vertex ofV, and vice versa. Such a one-to-one correspondencebetween the vertices belonging to V and V is an isomorphism between thegraphs (V, E) and (V, E) when it has the following additional property: apair of distinct vertices belonging to V are the endpoints of an edge of (V, E)if and only if the corresponding vertices belonging to V are the endpoints of

    an edge of (V

    , E

    ). There is then a one-to-one correspondence between theedges of the two graphs, induced by the one-to-one correspondence betweentheir vertices.

    10.7 Subgraphs

    Definition Let (V, E) and (V, E) be graphs. The graph (V, E) is said tobe a subgraph of (V, E) if and only if V V and E E (i.e., if and only ifthe vertices and edges of (V, E) are all vertices and edges of (V, E)).

    7

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    8/25

    Let (V, E) be a graph, and let V be a subset of V. Let

    E = {{a, b} E : a V and b V},

    (so that E be the set of all edges {a, b} belonging to E whose endpoints aand b belong to V). Then (V, E) is a subgraph of (V, E). It is referred toas the restriction of the graph (V, E) to V, or as the graph induced on V

    by the graph (V, E). If the graph (V, E) is denoted by G, then its restriction(V, E) to V may be denoted by G|V.

    10.8 Vertex Degrees

    Definition Let (V, E) be a graph. The degree deg v of a vertex v of thisgraph is defined to be the number of edges of the graph that are incidentto v (i.e., the number of edges of the graph which have v as one of theirendpoints).

    Definition A vertex of a graph of degree 0 is said to be an isolated vertex.

    Definition A vertex of a graph of degree 1 is said to be an pendant vertex.

    Theorem 10.1 Let (V, E) be a graph. Then

    vV

    deg v = 2|E|,

    wherevV

    deg v denotes the sum of the degrees of all the vertices of the graph,

    and |E| denotes the number of edges of the graph.

    Proof ClearlyvV

    deg v counts the number of times an edge of a graph is

    incident on a vertex of the graph. But this quantity must be twice the numberof edges of the graph, since each edge is incident on exactly two vertices.

    Corollary 10.2vV

    deg v is an even integer.

    Corollary 10.3 In any graph, the number of vertices of odd degree must be

    even.

    Definition A graph is said to be k-regular, for some non-negative integer k,if every vertex of the graph has degree equal to k. A regular graph is a graphthat is k-regular for some non-negative integer k.

    8

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    9/25

    Corollary 10.4 Let (V, E) be a k-regular graph. Then k|V| = 2|E|, where

    |V| denotes the number of vertices and |E| denotes the number of edges ofthe graph.

    Proof If the graph is k-regular then the sum of the degrees of the verticesof the graph is equal to k|V|. The result then follows immediately fromTheorem 10.1.

    Example The graph consisting of the vertices and edges of a square is 2-regular, since every vertex (i.e., every corner of the square) is incident toexactly two edges.

    Example A complete graph with n vertices is (n 1)-regular, since eachvertex is adjacent to all the remaining n 1 vertices.

    Example A complete bipartite graph Kp,q is regular if and only if p = q.

    10.9 Walks, Trails and Paths

    Definition Let (V, E) be a graph. A walk v0 v1 v2 . . . vn of length n inthe graph from a vertex a to a vertex b is determined by a finite sequencev0, v1, v2, . . . , vn of vertices of the graph such that v0 = a, vn = b and vi1 viis an edge of the graph for i = 1, 2, . . . , n.

    A walk v0 v1 v2 . . . vn in a graph is said to traverse the edges vi1vi fori = 1, 2, . . . , n and to pass through the vertices v0, v1, . . . , vn.

    Each vertex v in a graph determines a walk of length of length zero inthe graph, consisting of the single vertex v; such a walk is said to be trivial.

    Definition Let (V, E) be a graph. A trail v0 v1 v2 . . . vn of length n in thegraph from a vertex a to a vertex b is a walk of length n from a to b with theproperty that the edges vi1vi are distinct for i = 1, 2, . . . , n.

    A trail in a graph is thus a walk in the graph which traverses edges of thegraph at most once.

    Definition Let (V, E) be a graph. A path v0 v1 v2 . . . vn of length n in thegraph from a vertex a to a vertex b is a walk of length n from a to b with theproperty that the vertices v0, v1, . . . , vn are distinct.

    A path in a graph is thus a walk in the graph which passes throughvertices of the graph at most once.

    Definition A walk, trail or path in a graph is said to be trivial if it is awalk v of length zero determined by a single vertex v of v; otherwise it issaid to be non-trivial.

    9

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    10/25

    v0

    v1

    v2

    v3v4

    v5 v6

    v7

    v8 v9

    A trail v0 v1 . . . v9 in a graph

    10.10 Connected Graphs

    Definition An undirected graph is said to be connected if, given any twovertices u and v of the graph, there exists a path in the graph from u to v.

    Theorem 10.5 Letu and v be vertices of a graph. Then there exists a path

    in the graph from u to v if and only if there exists a walk in the graph from

    u to v.

    Proof Any path in a graph from one vertex to another is a walk. It thereforeonly remains to show that if there exists a walk in the graph from a vertex u

    to a vertex v, then there must also exist a path in the graph from u to v.Now if there exists at least one walk from u to v, then there must exist

    a walk from u to v whose length is less than or equal to that of every otherwalk from u to v. Let this walk be a0 a1 . . . an, where a0 = u and an = v.We claim that this walk is in fact a path from u to v. Indeed were it thecase that aj = ak for some integers j and k satisfying 0 j < k n thenthe walk a0 . . . aj ak+1 . . . an from u to v obtained on omitting the edgesaj aj+1, . . . , ak1 ak would be a walk from u to v whose length was strictlyless than that of the given walk (which is the shortest walk from u to v). Butthis is clearly impossible. Hence a0, a1, . . . , an must be distinct, and thus the

    the walk a0 a1 . . . an is a path from u to v.

    Corollary 10.6 An undirected graph is connected if and only if, given any

    two vertices u and v of the graph, there exists a walk in the graph from u to

    v.

    10.11 The Components of a Graph

    Let (V, E) be an undirected graph. We can define a relation on the set Vof vertices of the graph, where two vertices a and b of the graph satisfy a b

    10

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    11/25

    if and only if there exists a walk in the graph from a to b.

    Lemma 10.7 Let (V, E) be an undirected graph. Then the relation on theset V of vertices of the graph is an equivalence relation, where two vertices

    u and v of the graph satisfy u v if and only if there exists a walk in thegraph from u to v.

    Proof We must prove that the relation on V is reflexive, symmetric andtransitive.

    Clearly v v for any vertex v of the graph, since the trivial walk v iswalk from v to itself. Thus the relation is reflexive.

    Let u and v be vertices of the graph satisfying u v. Then there existsa walk u a1 a2 . . . an1 v from u to v. This walk may be reversed to obtain awalk v an1 an2 . . . a1 u from v to u. We conclude that if u v then v u.Thus the relation is symmetric.

    Finally let u, v and w be vertices of the graph for which u v andv w. Then there exists a walk u a1 a2 . . . an1 v from u to v, and a walkv b1 b2 . . . br1 w from v to b. These two walks may be concatenated to yielda walk

    u a1 a2 . . . an1 v b1 b2 . . . br1 w

    from u to w, showing that u w. Thus the relation is transitive. We haveshown that this relation is reflexive, symmetric and transitive. It is thereforean equivalence relation.

    The equivalence relation on the set V of vertices of the graph (V, E)gives rise to a partition of V as the disjoint union of subsets V1, V2, . . . , V m,where

    (i) V1 V2 Vk = V;

    (ii) Vi Vj = if i = j;

    (iii) two vertices u and v belong to a single subset Vi if and only if there

    exists a walk in (V, E) from u to v (i.e., if and only if u v).Ifu and v are the endpoints of some edge u v of the graph (V, E), then u v(since an edge can be considered as a walk of length one), and thus u and vbelong to the same set Vi. Thus, if we define

    Ei = {u v E : u Vi and v Vi},

    then (V1, E1), (V2, E2), . . . , (Vk, Ek) are subgraphs of (V, E), and

    V = V1 V2 Vk, E = E1 E2 Ek.

    11

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    12/25

    These subgraphs are disjoint since Vi Vj = and Ei Ej = if i = j.

    Moreover the graph (Vi, Ei) is the restriction of the graph (V, E) to Vi (alsodescribable as the graph induced on Vi by (V, E)) for i = 1, 2, . . . , k.

    The subgraphs (Vi, Ei) of (V, E) are referred to as the components (orconnected components) of the graph (V, E).

    (V1, E1) (V2, E2) (V3, E3)

    A graph with three components

    Lemma 10.8 The vertices and edges of any walk in an undirected graph are

    all contained in a single component of that graph.

    Proof Let v0 v1 . . . vn be a walk in a graph (V, E). Then v0 v1 . . . vr is awalk in (V, E) from v0 to vr for each integer r between 1 and m. It follows

    that each vertex vr through which the walk passes must belong to the samecomponent of the graph as v0. Therefore all the vertices and edges of thiswalk belong to a single component of the graph, namely that componentwhich contains the vertex v0.

    Lemma 10.9 Each component of an undirected graph is connected.

    Proof Let (V, E) be a graph, and let u and v be vertices belonging to Vi,where (Vi, Ei) is one of the components of this graph. Then there existsa walk in (V, E) from u to v. But the vertices and edges of this walk arecontained in a single component of the graph (V, E), by Lemma 10.8, andthat component must obviously be the component (Vi, Ei) that contains thevertices u and v. Thus there exists a walk in (Vi, Ei) from u to v. We concludethat the graph (Vi, Ei) is connected.

    Remark The importance of the concept of the components of a graph isthat it enables us to reduce the study of undirected graphs in general to thestudy of connected graphs. Indeed any undirected graph can be representedas a disjoint union of connected subgraphs: these subgraphs are the compo-nents of the given graph. These connected components may then be studied

    12

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    13/25

    individually. Moreover properties of any one component do not affect those

    of any other, since no edge of the graph passes from any one component ofthe graph to any other.

    10.12 Circuits

    Definition Let (V, E) be a graph. A walk v0 v1 v2 . . . vn in the graph is saidto be closed if v0 = vn.

    Thus a walk in a graph is closed if and only if it starts and ends at thesame vertex.

    Definition Let (V, E) be a graph. A circuit in the graph is a non-trivialclosed trail in the graph.

    We see therefore that a circuit in a graph is a closed walk with no repeatededges, and passing though at least two vertices.

    Definition A circuit v0 v1 v2 . . . vn1 v0 in a graph is said to be simple if thevertices v0, v1, v2, . . . vn1 are distinct.

    Remark Some authors use the term cycle to denote a simple circuit in a

    graph. Others use the term cycle to refer to a circuit in the graph, irrespectiveof whether or not it is simple.

    We now prove two theorems that provide sufficient conditions for a graphto contain simple circuits.

    Theorem 10.10 If a graph has no isolated or pendant vertices then it con-

    tains at least one simple circuit.

    Proof Let (V, E) be a graph with no isolated or pendant vertices. Thelength of any path in this graph cannot exceed |V| 1, where |V| denotesthe number of vertices of the graph, since a path of length m passes throughm + 1 distinct vertices. Therefore there exists a path v0 v1 v2 . . . vm in thegraph whose length m is greater than or equal to the length of every otherpath in the graph. Now the final vertex vm of the graph is adjacent to at leasttwo vertices of the graph, since the graph contains no isolated or pendantvertices. One of these vertices is vm1. If none of the vertices v0, v1, . . . , vm2were incident to vm then there would exist a vertex w adjacent to vm thatwas distinct from v0, v1, . . . , vm, and then v0, v1, . . . , vm w would be a path inthe graph with length exceeding m, which is impossible. It follows that at

    13

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    14/25

    least one of the vertices v0, v1, . . . , vm2 is incident to vm; let that vertex be

    vk, where 0 k m 2. Then vk vk+1 . . . vm vk is a simple circuit in thegraph. Thus a graph with no isolated or pendant vertices always contains asimple circuit.

    Theorem 10.11 Let u and v be vertices of a graph, where u = v. Supposethat there exist at least two distinct paths in the graph from u to v. Then the

    graph contains at least one simple circuit.

    Proof Let a0 a1 a2 . . . am and b0 b1 b2 . . . bn be two distinct paths in thegraph with a0 = b0 = u and am = bn = v. We may suppose that m n.Now the fact that paths are distinct ensures that there exists at least inte-

    ger i satisfying 0 < i m for which ai = bi. Let the smallest such integer ibe r + 1, where r is an integer in the range 0 r < m. Then ar = br andar+1 = br+1. Now the condition ai {bj : r < j n} is satisfied wheni = m, since am = bn. Let s be the smallest integer satisfying r < s mfor which as {bj : r < j n}. Then as = bt for some integer t satisfyingr < t n. Moreover none of the vertices ai with r < i < s belong to the set{bj : r < j < t}. It follows that

    ar ar+1 . . . as bt1 . . . br+1ar

    is a simple circuit in the graph. Thus the graph has at least one simple

    circuit, as required.

    10.13 Eulerian Trails and Circuits

    Definition An Eulerian trail in a graph is a trail that traverses every edgeof the graph.

    Note that an Eulerian trail in a graph must traverse every edge of thegraph exactly once, since a trail traverses an edge of the graph at most once.

    Definition An Eulerian circuit in a graph is a circuit that traverses every

    edge of the graph.

    It follows from these definitions that any closed Eulerian trail is an Eule-rian circuit.

    Example Let (V, E) be the complete graph K5 on five vertices a, b, c, d ande, where

    V = {a, b, c, d, e},

    E = {a b, a c, a d, a e, b c, b d, b e, c d, c e, d e}.

    14

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    15/25

    a

    b c

    de

    This graph has Eulerian circuits. One of them is the following:

    a b c a d e c d b e a .

    Remark Eulerian trails and circuits are named after the Swiss mathemati-cian Leonhard Euler (17071783), who first studied the problem of the exis-tence of such circuits in connection with the problem of the Seven Bridges ofKonigsberg. The citizens of this city used to amuse themselves by attempting

    to devise a walk around the city that would cross each of the seven bridgesexactly once. They always failed in this attempt, for reasons explained byEuler.

    We shall derive necessary and sufficient conditions for the existence ofEulerian trails and circuits in a connected graph. The following theorem willgive rise to a necessary condition for the existence of an Eulerian trail orcircuit.

    Theorem 10.12 Let v0 v1 . . . vm be a trail in a graph, and let v be a vertex

    of that graph. Then the number of edges of the trail incident to the vertex v

    is even, except in the case when the trail is not closed and the trail starts orfinishes at v, in which case the number of edges of the trail incident to the

    vertex v is odd.

    Proof First suppose that v = v0 and v = vm. The edges of the trail that areincident to v are then those of the form vi1 vi and vi vi+1 with 0 < i < mand vi = v. It follows that the number of edges of the trail incident to v isthen equal to twice the number of integers i satisfying 0 < i < m for whichv = vi, and is thus even.

    15

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    16/25

    If v = v0, and if the trail is not closed (i.e., if vm = v0), then the edges of

    the trail incident to v are the edge v0 v1 together with the edges vi1 vi andvi vi+1 for those integers i satisfying 1 < i < m for which v = vi. Thereforethe number of edges of the trail incident to v is then equal to one plus twicethe number of integers i satisfying 1 < i < m for which v = vi, and isthus odd. Similarly the number of edges of the trail incident to v is oddin the case when v = vm and the trail is not closed. Finally, in the casewhen the trail is closed and v = v0 = vm, the edges incident to v are v0 v1and vm1 vm, together with the edges vi1 vi and vi vi+1 for those integers isatisfying 1 < i < m for which v = vi. The total number of edges of the trailincident to v is therefore even.

    Corollary 10.13 Let v be a vertex of a graph. Then, given any circuit in

    the graph, the number of edges incident to v that are traversed by that circuit

    is even.

    Corollary 10.14 If a graph admits an Eulerian circuit then the degree of

    every vertex of the graph must be even.

    Proof Let v be a vertex of the graph. It follows from Corollary 10.13 thatthe number of edges of any Eulerian circuit incident to v is even. But everyedge incident to v is an edge of an Eulerian circuit, since an Eulerian circuit

    by definition traverses every edge of the graph. It follows that the degree ofthe vertex v is even, as required.

    Example Any attempt to find an Eulerian circuit in the complete graph K4on four vertices is guaranteed to fail, since such a graph is 3-regular (i.e., thedegree of each of the four vertices of the graph is equal to 3).

    Corollary 10.15 If a graph admits an Eulerian trail that is not a circuit

    then the degrees of exactly two vertices of the graph must be odd, and the

    degrees of the remaining vertices must be even. The two vertices with odd

    degrees will then be the initial and final vertices of the Eulerian trail.

    Proof As in the proof of Corollary 10.15 we see from Theorem 10.12 thatthe degree of a vertex of the graph must be even unless that vertex is one ofthe two endpoints of the trail, in which case the degree must be odd.

    We shall now work towards a proof of the fact that a non-trivial connectedgraph has an Eulerian circuit if the degree of each of its vertices is even. Forthis we use the results of the following lemmas.

    16

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    17/25

    Lemma 10.16 Let v w be an edge of a graph in which the degree of every

    vertex is even. Then there exists a circuit of the graph which traverses theedge v w.

    Proof Let v0 = v and v1 = w. Suppose that, for some positive integer k atrail v0 v1 . . . vk has been constructed in the graph starting at the vertex vand traversing the edge v w. Suppose also that vk = v. It follows fromTheorem 10.12 that the number of edges of the trail incident to vk must beodd. But the degree ofvk is even. It follows that the number of edges of thetrail incident to vk must be strictly less than the degree of vk, and thereforethere must exist at least one edge of the graph incident to vk which is not

    traversed by the trail v0 v1 . . . vk. Let that edge be vk vk+1, where vk+1 is avertex adjacent to vk. Then v0 v1 . . . vk vk+1 is a trail of length k + 1 in thegraph which starts at v and traverses the edge v w.

    Now the length of any trail in a graph cannot exceed the number of edgesof the graph, since each edge of the graph is traversed at most once by anytrail. It follows that successive extensions of the trail v w will ultimatelyresult in a trail that cannot be extended to a longer trail. This must thenbe closed (since we have just shown that if the trail is not closed then it canalways be extended). This closed trail is then the required circuit.

    Lemma 10.17 Suppose that a graph contains a circuit of length m and a

    circuit of length n. Suppose also that no edge of the graph is traversed by bothcircuits, and that at least one vertex of the graph is common to both circuits.

    Then the graph contains a circuit of length m + n.

    Proof Let u be a vertex of the graph which is common to both circuits.We may clearly suppose that both circuits start from and finish at this ver-tex u. Let the first circuit be u v1 . . . vm1 u and let the second circuit beu w1 . . . wn1 u. We can then concatenate these two circuits together to ob-tain a third circuit

    u v1 . . . vm1 u w1 . . . wn1u

    of length m + n.

    Lemma 10.18 Let (V, E) be a connected graph, and let some trail in thisgraph be given. Suppose that no vertex of the graph has the property that some

    but not all of the edges of the graph incident to that vertex are traversed by

    the trail. Then the given trail is an Eulerian trail.

    Proof Let V1 be the set of vertices through which the trail passes, and letV2 denote the set consisting of any remaining vertices of the graph. ThenV1 V2 = V and V1 V2 = . We will prove that V2 = .

    17

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    18/25

    Now any vertex belonging to V1 is incident to at least one edge traversed

    by the trail. But then all edges incident to a vertex belonging to V1 mustbe traversed by the trail. But then any vertex of V adjacent to a vertex inV1 must itself belong to V1, and thus no edge can join a vertex in V1 to avertex in V2. If the set V2 were non-empty then there could not exist anypath joining a vertex in V2 to a vertex in V1, and thus the graph would not beconnected. Therefore V2 must be empty, and V1 = V. But then every edgeof (V, E) must be traversed by the trail, and thus the trail is an Euleriantrail.

    Lemma 10.19 Let (V, E) be a connected graph with the property that the

    degree of every vertex of the graph is even, and let some circuit in this graphbe given. Suppose that there is some vertex v of the graph with the property

    that some but not all of the edges of the graph incident to that vertex are

    traversed by the given circuit. Then there exists a second circuit in the graph

    (V, E) which passes through the vertex v and which does not traverse anyedge which is traversed by the given circuit.

    Proof let E denote the subset of E consisting of those edges of the graphthat are not traversed by the given circuit. Then (V, E) is a subgraph of thegiven graph (V, E). Given any vertex w, the number of edges of the givencircuit that are incident to w is equal to d(w) d(w), where d(w) is thenumber of edges in E incident to w, and d(w) is the number of edges in E

    incident to w. It follows from Lemma 10.13 that d(w) d(w) is an eveninteger. But the degree d(w) of each vertex w of the graph (V, E) is even, byassumption, and therefore d(v) is also even. Thus the degree of every vertexin the subgraph (V, E) is even.

    Now the vertex v of the graph has the property that some but not allof edges incident to this vertex are traversed by the given trail. Thereforesome at least of the edges of the graph (V, E) incident to v are edges also ofthe subgraph (V, E). It then follows from Lemma 10.16 that the subgraph(V, E) contains a circuit which passes through the vertex v. This circuit is

    of course a circuit in the graph (V, E), it passes through the vertex v, and itdoes not traverse any edge of the graph (V, E) that is traversed by the givencircuit.

    Theorem 10.20 A non-trivial connected graph contains an Eulerian circuit

    if the degree of every vertex of the graph is even.

    Proof Let (V, E) be a non-trivial connected graph with the property thatthe degree of every vertex is even. An easy application of Lemma 10.16 shows

    18

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    19/25

    that such a graph contains at least one circuit. It therefore contains a circuit

    which is at least as long as every other circuit in the graph. We shall showthat this circuit of maximal length is an Eulerian circuit.

    Now if the graph were to contain some vertex v with the property thatsome but not all of the edges of the graph incident to that vertex are traversedby this circuit of maximal length, then it would follow from Lemma 10.19that there would exist a second circuit in the graph (V, E) which would alsopass through the vertex v, and which would not traverse any trail traversedby the circuit of maximal length. But it would then follow immediately fromLemma 10.17 that the graph would contain a circuit which was longer thanthe circuit of maximal length, which is clearly impossible.

    We conclude therefore that the graph cannot contain any vertex v withthe property that some but not all of the edges of the graph incident to thatvertex are traversed by the circuit of maximal length. It now follows fromLemma 10.18 that such a circuit of maximal length must be an Euleriancircuit.

    Remark A careful examination of the proofs of Lemma 10.16, Corollary 10.17and Lemma 10.19 shows that they provide an algorithm for constructing anEulerian circuit in a non-trivial connected graph whose vertices all have evendegree. Indeed the proof of Lemma 10.16 shows how circuits can be con-structed in such a graph, and the proofs of Corollary 10.17 and Lemma 10.19show how to replace a circuit that is not an Eulerian circuit by a strictlylonger circuit. A finite number of such replacements must ultimately resultin an Eulerian circuit.

    On combining the results of Corollary 10.14 and Theorem 10.20 we con-clude that a non-trivial connected graph has an Eulerian circuit if and onlyif the degree of each of its vertices is even.

    We now prove the result corresponding to Theorem 10.20 for non-trivialconnected graphs with exactly two vertices whose degree is odd.

    Corollary 10.21 Suppose that a connected graph has exactly two verticeswhose degrees are odd. Then there exists an Euler trail in the graph joining

    the two vertices with odd degrees.

    Proof Let (V, E) be the graph, and let v and w be the two vertices of thisgraph whose degree is odd. We may embed the graph (V, E) as a subgraphof a larger graph (V, E) whose vertices all have even degree. We choose thegraph (V, E) such that V = V {u} and E = E {v u, u w}, where uis a vertex of V that does not belong to V, and is the only such vertex of

    19

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    20/25

    V. The graph (V, E) is then non-trivial and connected, and every vertex

    of (V, E) has even degree. (Indeed the degree of the vertex u in the graph(V, E) is equal to 2, and the degrees of the vertices v and w in the graph(V, E) exceed by one their degrees in the graph (V, E).) It follows fromTheorem 10.20 that the graph (V, E) has an Eulerian circuit. We mayorder the vertices of this circuit so that the final two edges of the circuit arew u and u v. Deletion of these two edges from the circuit yields the requiredEulerian trail in the graph (V, W) from v to w.

    10.14 Hamiltonian Paths and Circuits

    Definition A Hamiltonian path in a graph is a path that passes (exactlyonce) through every vertex of the graph.

    Thus a path v0 v1 v2 . . . vn in a graph (V, E) is a Hamiltonian path if andonly ifV = {v0, v1, . . . , vn}. A Hamiltonian path passes can have no repeatedvertices (since it is a path) and therefore passes through each vertex of thegraph exactly once.

    Definition A Hamiltonian circuit in a graph is a simple circuit that passesthrough every vertex of the graph.

    Thus a circuit v0 v1 v2 . . . vn1 v0 in a graph (V, E) is a Hamiltonian cir-cuit if and only if every vertex of the graph occurs exactly once in the listv0, v1, . . . , vn1.

    Remark Hamiltonian circuits are are named after William Rowan Hamilton(18051865), who showed in 1856 that such circuits could be found in thegraph consisting of the vertices and edges of a dodecahedron. Hamilton de-veloped an icosian calculus for the study such circuits in the dodecahedron,and formulated a game, the icosian game, in which people were challengedto complete any path of length two in this graph to a Hamilton circuit in the

    graph.

    10.15 Forests and Trees

    Definition A graph is said to be acyclic if it contains no circuits.

    Definition A forest is an acyclic graph.

    Definition A tree is a connected forest.

    20

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    21/25

    FD

    CB

    G

    K

    M

    PZ

    H

    Q

    X

    J L

    N

    R

    W

    V T

    S

    Hamiltons circuit round the edges of a dodecahedron

    Note that the components of any forest are trees.

    Example The graph (V, E), where

    V = {a, b, c, d, e, f, g},

    E = {a b, bc, bd, c e, b f, cg},

    is a tree.

    a

    b

    cd

    e

    f

    g

    The vertices a, d, e, f and g are pendant vertices (i.e., each of thesevertices is incident to exactly one edge of the graph, and is therefore ofdegree one.) The tree has 7 vertices and 6 edges.

    21

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    22/25

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    23/25

    Theorem 10.25 Given two distinct vertices of a tree, there exists a unique

    path in the tree from the first vertex to the the second.

    Proof Let u and v be distinct vertices of the tree. There must exist at leastone path in the tree from u to v, since any tree is connected. Were thereto exist more than one, then it would follow from Theorem 10.11 that therewould exist at least one circuit in the tree, which is impossible, since thata tree cannot contain any circuits. Therefore there must exist exactly onepath in the tree from u to v.

    10.16 Spanning Trees

    Definition A spanning tree in a graph (V, E) is a subgraph of the graph(V, E) that is a tree which includes every vertex of the graph (V, E).

    A spanning tree in a graph

    Theorem 10.26 Every connected graph contains a spanning tree

    Proof Let (V, E) be a connected graph. The collection consisting of all theconnected subgraphs of (V, E) with the same vertices as (V, E) is non-empty,

    since it includes the graph (V, E) itself. Choose a subgraph (V, E

    ) in thiscollection such that the number |E| of edges in this subgraph is less thanor equal to the number of edges of any other subgraph in the collection. Weclaim that (V, E) is the required spanning tree. Clearly (V, E) is connectedand has the same vertices as V. It only remains to show that (V, E) doesnot contain any circuits.

    Suppose that (V, E) were to contain a circuit. Let v w be an edge tra-versed by some circuit in (V, E), and let E = E\ {v w}. There would thenexist a walk from v to w whose edges belong to E. (Such a walk could

    23

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    24/25

    consist of the remaining edges of the circuit traversing the edge v w.) More-

    over every vertex in V could be joined to v by a walk whose edges belong toE, and could therefore be joined either to v or to w by a walk whose edgesbelong to E. It would then follow that every vertex of V could be joined tov by a walk whose edges belong to E, and therefore the graph (V, E) wouldbe a connected subgraph of (V, E) with the same vertices as (V, E) and withfewer edges than (V, E), which is impossible. We conclude therefore thatthe subgraph (V, E) of (V, E) cannot contain any circuits and is thereforethe required spanning tree.

    Corollary 10.27 Let (V, E) be a connected graph with |V| vertices and |E|

    edges. Suppose that |E| = |V| 1. Then the graph (V, E) is a tree.

    Proof A connected graph (V, E) contains a spanning tree, by Theorem 10.26.This spanning tree must have |V|1 edges, by Theorem 10.24. But the span-ning tree then has the same number of edges as the original graph (V, E), andmust therefore be the same as this graph. It follows that the graph (V, E)must be a tree, since it is a spanning tree of itself.

    10.17 Directed Graphs

    Definition An directed graph or digraph (V, E) consists of a finite set Vtogether with a subset E of V V. The elements of V are the vertices ofthe digraph; the elements of E are the edges of the digraph.

    An edge of a digraph (V, E) is an ordered pair (a, b) where a and b arevertices of the graph. These vertices need not be distinct: a digraph maycontain loops of the form (a, a), where a is some vertex of the digraph. Alsothe vertices of an edge of a digraph are ordered: ifa and b are distinct verticesof the graph then (a, b) = (b, a), and moreover neither, one only, or both of(a, b) and (b, a) may be edges of the digraph.

    Let (a, b) be an edge of a directed graph (V, E). We say that a is the

    initial vertex and b is the terminal vertex of the edge. Moreover we say thatthe vertex b is adjacent from the vertex a, and the vertex a is adjacent tothe vertex b, and the edge (a, b) is incident from the vertex a and incidentto the vertex b.

    10.18 Adjacency Matrices of Directed Graphs

    Definition Let (V, E) be a directed graph, and let the vertices of the graphbe ordered as v1, v2, . . . , vm. The adjacency matrix of the directed graph is

    24

  • 7/27/2019 Wilkins - Graph Theory - 2BA1s10_0607

    25/25

    the m m matrix (bij), or

    b11 b12 . . . b1mb21 b22 . . . b2m

    ......

    . . ....

    bm1 am2 . . . bmm

    ,

    where

    bij =

    1 if (vi, vj) E;0 otherwise.

    Example Let (V, E) be the directed graph whose vertices are ordered as v1,v2, v3 and v4, and whose edges are ordered as e1, e2, e3 and e4, where

    e1 = (v1, v2), e2 = (v2, v3), e3 = (v3, v4), e4 = (v4, v1).

    v1 v2

    v3v4

    e1

    e2

    e3

    e4

    The adjacency matrix of this digraph is

    0 1 0 00 0 1 00 0 0 11 0 0 0

    ,

    10.19 Directed Graphs and Binary Relations

    There is a correspondence between directed graphs and binary relations onfinite sets.

    Let V be a finite set. Corresponding to any relation R on V there is adirected graph (V, E), where

    E = {(a, b) V V : aRb}.

    Conversely any directed graph (V, E) gives rise to a relation R on the set Vof vertices of the digraph, where vertices a and b of the graph satisfy aRy ifand only if (a, b) R.

    25