49
Graph Theory A.Benedict Balbuena Institute of Mathematics, University of the Philippines in Diliman 8.2.2008 A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 1 / 47

Introduction to-graph-theory-1204617648178088-2

Embed Size (px)

DESCRIPTION

Graph Theory

Citation preview

Page 1: Introduction to-graph-theory-1204617648178088-2

Graph Theory

A.Benedict Balbuena

Institute of Mathematics, University of the Philippines in Diliman

8.2.2008

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 1 / 47

Page 2: Introduction to-graph-theory-1204617648178088-2

Definitions

Simple Graph

DefinitionA simple graph G(V , E) consists of a nonempty set V of verticesand a set E of edges such that each edge e ∈ E is associatedwith an unordered pair of distinct vertices, called its endpoints.

Vertices are adjacent if there is an edge connecting the twovertices.An edge is incident to its endpoints.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 2 / 47

Page 3: Introduction to-graph-theory-1204617648178088-2

Definitions

Simple Graph

DefinitionA simple graph G(V , E) consists of a nonempty set V of verticesand a set E of edges such that each edge e ∈ E is associatedwith an unordered pair of distinct vertices, called its endpoints.

Vertices are adjacent if there is an edge connecting the twovertices.An edge is incident to its endpoints.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 2 / 47

Page 4: Introduction to-graph-theory-1204617648178088-2

Definitions

Degree

DefinitionThe degree of a vertex in a simple graph, denoted deg(v), is thenumber of edges incident on it.

degree also means number of adjacent vertices

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 3 / 47

Page 5: Introduction to-graph-theory-1204617648178088-2

Definitions

Handshaking Lemma

TheoremGiven a simple graph G(V , E),

2|E | =∑v∈V

deg(v)

Proof.Each edge contributes 1 each to the degree of its endpoints.Thus each edge adds 2 to the total degree of G.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 4 / 47

Page 6: Introduction to-graph-theory-1204617648178088-2

Definitions

TheoremIn any simple graph, there are an even number of vertices ofodd degree

Proof.Let G(V , G) be a simple graph. The sum of all the degrees ofthe vertices is 2|E |, an even number. Let deven be the sum ofdegrees of vertices with even degree and dodd the sum ofdegrees of vertices with odd degree. The total deven is even, thusdodd is even. This implies that there must be an even number ofthe odd degrees. Hence, there must be an even number ofvertices with odd degree.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 5 / 47

Page 7: Introduction to-graph-theory-1204617648178088-2

Paths

Paths and Cycles

DefinitionA path is a sequence of vertices v0, v1, v2, ..., vn where there isan edge connecting vi and vi+1 for i = 0, 1, .., n − 1. A path withthe same starting and endpoint is called a cycle (circuit). Agraph is simple if no edge is repeated.

acyclic graph has no cycles

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 6 / 47

Page 8: Introduction to-graph-theory-1204617648178088-2

Paths

Adjacency Matrix

DefinitionThe adjacency matrix of a simple graph G with n vertices is abinary n× n matrix such that each entry ai,j is either zero or one.ai,j = 0 if there is no edge from vi to vj , otherwise it is 1.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 7 / 47

Page 9: Introduction to-graph-theory-1204617648178088-2

Paths

TheoremLet G be a graph with adjacency matrix A with respect to theordering v1, v2, ..., vn and r a positive integer. The number ofdifferent paths of length r from vi to vj is the (i , j)-th entry of Ar

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 8 / 47

Page 10: Introduction to-graph-theory-1204617648178088-2

Paths

Connectedness

DefinitionA simple graph is called connected if there is a path betweenevery pair of distinct vertices. A graph that is not connected issaid to be disconnected

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 9 / 47

Page 11: Introduction to-graph-theory-1204617648178088-2

Paths

TheoremThere is a simple path between every pair of distinct vertices ofa connected simple graph

Proof.Let u and v be two distinct vertices of a connected simple graphG. SInce G is connected then there is a path from u to v , sayu = x0, x1, ..., xn−1, xn = v . If this were not simple, then there is asubpath where xi = xj for some i and j with 0 ≤ i ≤ j . Meaningthere is a path from u to v of shorter length with vertexsequence u, x1, ..., xi−1, xj , ..., v obtained by deleting the edges ofthe subpath.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 10 / 47

Page 12: Introduction to-graph-theory-1204617648178088-2

Paths

Euler Paths

DefinitionA simple path that contains all edges of a graph is called anEuler path. If this path is also a circuit, it is called an Eulercircuit.

eulerian graphs have euler circuits

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 11 / 47

Page 13: Introduction to-graph-theory-1204617648178088-2

Paths

TheoremIf a simple graph has an Euler circuit then every vertex of thegraph has even degree.

Proof.Let G be a graph with an Euler circuit. Start at some vertex onthe circuit and follow the circuit from vertex to vertex, erasingeach edge as you go along it. When you go through a vertexyou erase one edge going in and one edge going out, reducingthe degree of the vertex by 2. Eventually every edge getserased and all the vertices have degree 0. So all vertices musthave had even degree to begin with.

contrapositive??

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 12 / 47

Page 14: Introduction to-graph-theory-1204617648178088-2

Paths

CorollaryIf a graph has a vertex with odd degree then the graph can nothave an Euler circuit.

TheoremIf all the vertices of a connected graph have even degree, thenthe graph has an Euler circuit.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 13 / 47

Page 15: Introduction to-graph-theory-1204617648178088-2

Paths

TheoremA connected graph has an Euler path but not an Euler circuit ifand only if it has exactly two vertices of odd degree.

Proof.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 14 / 47

Page 16: Introduction to-graph-theory-1204617648178088-2

Paths

Fleury’s Algorithm

constructs an Euler circuit in a graph (if it’s possible).âreduced graphâ = original graph minus the darkened (alreadyused) edges

1 Pick any vertex to start2 From that vertex pick an edge to traverse, considering

following rule: never cross a bridge of the reduced graphunless there is no other choice

3 Darken that edge, as a reminder that you can’t traverse itagain

4 Travel that edge, coming to the next vertex5 Repeat 2-4 until all edges have been traversed, and you are

back at the starting vertex

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 15 / 47

Page 17: Introduction to-graph-theory-1204617648178088-2

Paths

Hamilton Paths

DefinitionA path is called a Hamiltonian path if it visits every vertex of thegraph exactly once. A circuit that visits every vertex exactly onceexcept for the last vertex which duplicates the first one is calleda Hamiltonian circuit.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 16 / 47

Page 18: Introduction to-graph-theory-1204617648178088-2

Paths

TheoremIf G is a connected simple graph with n vertices where n ≥ 3,then G has a Hamilton circuit if the degree of each vertex is atleast

n2

.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 17 / 47

Page 19: Introduction to-graph-theory-1204617648178088-2

Paths

Gray Code

A gray code

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 18 / 47

Page 20: Introduction to-graph-theory-1204617648178088-2

Special Graphs

Complete Graph Kn

DefinitionA complete graph on n vertices (clique), denoted by Kn, is thesimple graph where each vertex is adjacent to all the othervertices.

Find a formula for the number of edges in Kn

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 19 / 47

Page 21: Introduction to-graph-theory-1204617648178088-2

Special Graphs

Paths and Cycles

DefinitionA path on n vertices Pn, is the simple graph consisting of a path.The end-vertices have degree 1 and all vertices in betweenhave degree 2.

DefinitionA Cycle on n vertices Cn, is the simple graph consisting of acycle where each vertex has degree two.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 20 / 47

Page 22: Introduction to-graph-theory-1204617648178088-2

Special Graphs

Wheels and Stars

DefinitionA wheel on n vertices Wn, is the simple graph consisting of acycle Cn and another vertex which is adjacent to all vertices inthe cycle.

DefinitionA star on n vertices is the simple graph consisting n + 1 vertice,n of which are connected to the n + 1-th vertex.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 21 / 47

Page 23: Introduction to-graph-theory-1204617648178088-2

Special Graphs

Bipartite Graphs

DefinitionA bipartite graph is a simple graph in which the vertices can bepartitioned into two disjoint sets V1 and V2 where every edge isincident to one vertex in V1 and one vertex in V2.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 22 / 47

Page 24: Introduction to-graph-theory-1204617648178088-2

Special Graphs

Complete Bipartite Graph

DefinitionA complete bipartite graph Km,n is the graph that has its vertexset partitioned into two disjoint subsets of m and n vertices,respectively. Moreover, there is an edge between two vertices ifand only if one vertex is in the first set and the other vertex is inthe second set.

Each vertex is connected to all the other vertices in the othersubset.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 23 / 47

Page 25: Introduction to-graph-theory-1204617648178088-2

Special Graphs

N-cube

DefinitionThe n-cube (hypercube) Qn is the graph whose vertices arebinary strings of length n. Two vertices are adjacent if and only ifthe bit strings differ in eactly one position.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 24 / 47

Page 26: Introduction to-graph-theory-1204617648178088-2

Special Graphs

Regular Graphs

DefinitionIf each vertex of a simple graph has degree k then the graph iscalled a regular graph of degree k

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 25 / 47

Page 27: Introduction to-graph-theory-1204617648178088-2

Relation Between Graphs

DefinitionA graph H(VH , EH) is a subgraph of G(V , E) if and only ifVH ⊆ V and EH ⊆ E

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 26 / 47

Page 28: Introduction to-graph-theory-1204617648178088-2

Relation Between Graphs

Isomorphic Graphs

DefinitionTwo simple graphs G1(V1, E1) and G2(V2, E2) are isomorphic,denoted G1

∼= G2, if there is a one-to-one onto functionf : V1 −→ V2 such that if v1, v2 are adjacent vertices in G1 thenf (v1), f (v2) are adjacent vertices in G2

Edges are preservedThe number of vertices, the number of edges, degrees of thevertices, cycles, longest paths are all invariants underisomorphism.If any of these quantities differ in two graphs, they are notisomorphic.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 27 / 47

Page 29: Introduction to-graph-theory-1204617648178088-2

Planar Graphs

Planar Graphs

DefinitionA graph is planar if there is a way to draw it in the plane withoutedges crossing.

such drawing is called a planar representation, which splits theplane into regionsplanar graphs are relatively easy for humans to grasp sincethere are no crisscrossing edges. Sometimes the advantages ofplanarity are more concrete; for example, when wires arearranged on a surface, like a circuit board or microchip

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 28 / 47

Page 30: Introduction to-graph-theory-1204617648178088-2

Planar Graphs

Jordan Curve Theorem

TheoremEvery simple, closed curve separates the plane into two regions,an inside and an outside.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 29 / 47

Page 31: Introduction to-graph-theory-1204617648178088-2

Planar Graphs

Drawing Planar Representations

For connected graphs

Start with a vertex and record faces while drawing.Faces are enclosed by circuitsPrecise rules defining the cycles that are the face boundaries ofa Planar Drawing:

1 Attach edge from vertex on a face to a new vertex.2 Attach edge between nonadjacent vertices on a face.

Every connected planar drawing is obtained by starting with asingle vertex, and repeatedly applying the Rules. Properties ofplanar drawings like Eulerâs formula can be proved by inductionon the number of rule applications used to create a drawing.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 30 / 47

Page 32: Introduction to-graph-theory-1204617648178088-2

Planar Graphs

Euler’s FormulaTheoremIf a connected planar representation of a graph has v vertices, eedges, and f faces, then

v − e + f = 2

Proof.Show this by induction on the number of edges. For the base case, ifthere is no edge then we have 1 verte and 1 face which satisfies theequation. We assume that given n number of edges, v − e + f = 2. Ifwe add an edge, we let it attach it to a new vertex or to an old vertex.For the first one, we choose a face and add an edge with a newvertex, thus v + 1− e − 1 + f = 2. On the other hand, we choose aface and add an edge across it. This splits the face into two new faces,thus v − e − 1 + f + 1 = 2.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 31 / 47

Page 33: Introduction to-graph-theory-1204617648178088-2

Trees

DefinitionA simple graph is called a tree if each pair of distinct verticeshas exactly one path.

is a tree connected? do trees have cycles?

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 32 / 47

Page 34: Introduction to-graph-theory-1204617648178088-2

Trees

TheoremAny tree with more than one vertex has at least one vertex ofdegree 1.

Proof.Let v0 and vn be two distinct vertices. Then there is a pathconnecting v0 to vn. By the definition of a tree, there is only oneedge incident on either v0 or vn. Hence, either deg(v0) = 1 ordeg(v1) = 1.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 33 / 47

Page 35: Introduction to-graph-theory-1204617648178088-2

Trees

TheoremA tree with n vertices has exactly n − 1 edges.

Proof.We show this by induction on n.Let P(n) = Any tree with n vertices has n − 1 edges.P(1) is valid since a tree with one vertex has zero edges.Suppose that P(n) holds, we show P(n + 1) holds, any tree withn + 1 vertices has n edges.Indeed, let T be any tree with n + 1 vertices. Since n + 1 ≥ 2then by the previous theorem, T has a vertex v of degree 1. LetT0 be the graph obtained by removing v and the edge attachedto v . Then T0 is a tree with n vertices. By the inductionhypothesis, T0 has n − 1 edges and so T has n edges.

is the converse true??A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 34 / 47

Page 36: Introduction to-graph-theory-1204617648178088-2

Trees

TheoremAny connected graph with n vertices and n − 1 edges is a tree.

A rooted tree is a tree in which a particular vertex is designatedas the root.The level of a vetex v is the length of the simple path from theroot to v .The height of a rooted tree is the maximum length of a path inthe tree.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 35 / 47

Page 37: Introduction to-graph-theory-1204617648178088-2

Trees

DefinitionLet T be a rooted tree with root v0. Suppose v0, v1, ..., vn is asimple path in T and x , y , z are three vertices. Then

1 vn−1 is the parent of vn

2 v0, v1, ..., vn−1 are the ancestors of vn:3 vn is the child of vn−1

4 If x is an ancestor of y then y is a descendant of x5 If x and y are children of z then x and y are siblings6 If x has no children, then x is a leaf.7 The subtree of T rooted at x is the graph whose vertices

consist of x and its descendants and whose edges areedges in the graph T with e

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 36 / 47

Page 38: Introduction to-graph-theory-1204617648178088-2

Trees

DefinitionA binary tree is a rooted tree such that each vertex has at mosttwo children, left child or a right child. A full binary tree is abinary tree in which each vertex has either two or zero children.

maximum degree in a binary tree??

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 37 / 47

Page 39: Introduction to-graph-theory-1204617648178088-2

Trees

DefinitionT is a spanning tree of a graph G if it is a subgraph of G that is atree and contains all of the vertices of G.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 38 / 47

Page 40: Introduction to-graph-theory-1204617648178088-2

Coloring

Coloring

DefinitionA coloring of a simple graph is the assignment of a color to eachvertex so that no two adjacent vertices have the same color

DefinitionA graph is k − colorable if each vertex can be assigned one ofthe k colors so that adjacent vertex get different colors.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 39 / 47

Page 41: Introduction to-graph-theory-1204617648178088-2

Coloring

TheoremA graph with maximum degree at most k is (k+1)-colorable.

DefinitionThe chromatic number of a graph is the least number of colorsneeded to color a graph

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 40 / 47

Page 42: Introduction to-graph-theory-1204617648178088-2

Digraphs

Digraphs

DefinitionA directed graph or digraph D(X , A) consists of a nonempty setV of vertices and a set E of arcs such that each arc a ∈ A isassociated with an ordered pair of distinct vertices.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 41 / 47

Page 43: Introduction to-graph-theory-1204617648178088-2

Digraphs

Digraphs

DefinitionA directed graph or digraph D(X , A) consists of a nonempty setV of vertices and a set E of arcs such that each arc a ∈ A isassociated with an ordered pair of distinct vertices.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 41 / 47

Page 44: Introduction to-graph-theory-1204617648178088-2

Digraphs

In and Out Degrees

DefinitionWhen (u, v) is an arc a digraph then u is called the initial vertexand v is called the terminal vertex. In a directed graph, thein-degree of a vertex v , denoted by deg−(v), is the number ofedges with v as their terminal vertex. Similarly, the out-degreeof v , denoted by deg+(v), is the number of edges with v as aninitial vertex.

denote arc (u, v) by u → vu → v means u in-neighbor of v and v out-neighbor of uNote that deg(v) = deg+(v) + deg−(v)

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 42 / 47

Page 45: Introduction to-graph-theory-1204617648178088-2

Digraphs

DefinitionThe set of out-neighbors of a vertex v and the vertex v itself iscalled the vicinity of v , denoted N(v).

DefinitionA vertex is a source if it has no in-neighbor and is an in-neighborof at least one vertex. A vertex is a sink if it has no outneighborand is an out-neighbor of at least one other vertex

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 43 / 47

Page 46: Introduction to-graph-theory-1204617648178088-2

Digraphs

TheoremGiven digraph D(X , A),

|E | =∑v∈X

deg+(v) =∑v∈X

deg−(v)

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 44 / 47

Page 47: Introduction to-graph-theory-1204617648178088-2

Digraphs

Directed Paths

DefinitionA directed path of length n (where n is a positive integer) from uto v in a digraph is a sequence of points u = v0, v1, v2, ..., vn = vwhere there is an arc connecting vi and vi+1 for i = 0, 1, .., n − 1.A path with the same starting and endpoint is called a cycle(circuit). A directed path is simple if no edge is repeated.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 45 / 47

Page 48: Introduction to-graph-theory-1204617648178088-2

Digraphs

Connectedness

DefinitionA digraph is strongly connected if there is a path from a to b andfrom b to a whenever a and b are vertices in the graph.

DefinitionA digraph is weakly connected if there is a path between anytwo vertices in its underlying undirected graph.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 46 / 47

Page 49: Introduction to-graph-theory-1204617648178088-2

Digraphs

Transitive Digraphs

DefinitionA transitive digraph is a digraph D(V , A) such that for any threevertices u, v , x ∈ V , if u → v and v → x then u → x .

DefinitionThe underlying undirected graph of a transitive digraph is calleda comparability graph.

A.B.C.Balbuena (UP-Math) Graph Theory 8.2.2008 47 / 47