48
Graphs & Networks (MATH F243) Dr. Krishnendra Shekhawat

Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Graphs & Networks (MATH F243)Dr. Krishnendra Shekhawat

Page 2: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

• Handout

• Quizzes (10 Marks, 10 Minutes, Best 4 out of 5)

• Tutorial Sheets (Nalanda)

• Textbook

2

Page 3: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Textbook

G. Agnarsson and R. Greenlaw, Graph Theory: Modeling, Applications, and Algorithms,

Pearson, 2007.

3

Page 4: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Chapter 1 Introduction to Graph Theory

Page 5: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Introduction

5

The theory of graphs is one of the few fields of mathematics with a definite birth date (Oystein Ore, author of first graph theory book written in English).

Graph theory is considered to have begun in 1736 with the publication of Euler’s solution of Kőnigsberg Bridge Problem (Leonard Euler, known to be the Father of Graph Theory).

Two hundred years later, in 1936, Denes Konig wrote the first book on graph theory.

Graph Theory branches – Theoretical, Algorithmic, Algebraic

Page 6: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

1.2 Why Study Graphs?• Problem 1.1: The Bridges of Kőnigsberg (1736 Leonard Euler)

6

Problem: Make a round trip through downtown Kőnigsberg, traversing each bridge exactly once.

Page 7: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

7

Ans: Euler proved that this problem has no solution. (Chapter 5)

Try to have even degree for all vertices and get a solution.

Q: Start at a vertex, go along each edge exactly once, and end up at the starting vertex?

Page 8: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

8

Problem 1.3: Job Assignments

Jobs:

Applicants:

qualified

Bipartite Graph

Problem 1.8: Is the company able to meet its hiring need? If so, provide a possible set of hires that meet their needs.

Ans: No (Ch10 Matching)

Page 9: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

9

Problem 1.4: Storing Volatile Chemicals

C1, C2, …, C7 are different kinds of chemicals where an edge between Ci and Cj indicates a grave danger in storing these chemicals in the same warehouse.

Q. What is the minimum number of warehouses the factory needs in order to store its chemical products safely?

Page 10: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

10

Problem 1.4: Storing Volatile Chemicals

Problem: What is the minimum number of warehouses the factory needs in order to store its chemical products safely?Ans: 4 (Ch8: Graph Coloring)

1

2

3

12

3

4

Page 11: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

1.4 The Definition of a Graph• A graph or a general graph is an ordered triple G = (V, E, ), where i. V (empty set). ii. VE = . iii. (edgemap): E P(V) is a map such that |(e)| {1, 2} for each

eE.

• Elements of V are called vertices of G (Vertex set V(G))• Elements of E are called edges of G (Edge set E(G))• Vertex and edge are denoted by v and e respectively• Vertices in (e) are called endvertices of the edge e• If both V and E are finite then G is finite graph, if V or E is infinite then G is called infinite (unless otherwise stated, a graph always mean finite graph).

11

Page 12: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Example

12

G=(V, E, )V={u1, u2, u3, u4, u5}E={e1, e2, e3, e4, e5, e6}

(e1)={u1, u2}(e2)=(e3)={u1, u3}(e4)={u2, u3}(e5)={u3, u4}(e6)={u4}

u5 is called isolated.

Compute (ei) for all i

Page 13: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Ch1-13

Definition of a graph

• A graph G is a finite nonempty set V(G) of vertices (also called nodes) and a (possibly empty) set E(G) of 2-element subsets of V(G) called edges (or lines).

• V(G) : vertex set of G• E(G) : edge set of G• Edge {u, v} = {v, u} = uv (or vu)

Page 14: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

14

Page 15: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Order, Size, Adjacency• The number of vertices in a graph G is called its order (denoted by

|V(G)| ).• The number of edges is its size (denoted by |E(G)|).• Two vertices u and v are adjacent (or neighbors) if they are endpoints of some edge eE.• Two edges e and f are adjacent if they have a common endvertex. • u and e are incident if u is an endvertex of e. • Loop: A loop is an edge whose endvertices are equal.• E’ is a set of multiple or parallel edges if all |E’|≥2 and e’E’ have the same set of endvertices.• u is called isolated if it is not an endvertex of any edge.

15

Page 16: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Example

16

Endvertices of e2: u1, u3u1, u2: adjacentu1, u4: not adjacente1, e2: adjacente1, e5: not adjacente3, e2: parallelu4 is adjacent to itselfe6 is adjacent to itself

Page 17: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

17

Q. Show that any graph with at least 6 vertices contains 3 vertices that are pairwise adjacent, or 3 vertices that are pairwise non-adjacent.

Pick an arbitrary vertex v1. There are at least 5 other vertices, such that either v1 has at least 3 neighbors, or it has at least 3 non-neighbors. In the first case, label the neighbors v2, v3, v4. If any two of v2, v3, v4 are adjacent, then with v1 they form a pairwise adjacent triple; otherwise, no two are adjacent, so v2, v3, v4 form a pairwise non-adjacent triple. Similarly, in the case where v1 has 3 non-neighbors v2, v3, v4, we get a pairwise non-adjacent triple if any 2 of v2, v3, v4 are not adjacent, and otherwise v2, v3, v4 are pairwise adjacent.

Page 18: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

1.5 Examples of Common Graphs• Simple graph: A graph having no multiple edges or loops.

• Null graph

18

Page 19: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

19

Path graph

Page 20: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

20

Cycle graph

Page 21: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

21

Complete graph

Complete graph K7

Page 22: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

A graph G is bipartite if V(G)=V1 V2 such that every edge of G

joins a vertex of V1 and a vertex of V2.

G: v1 v6

v4 v5 v3 v2

redrawn of G

V1

V2

disjoint union

v1v2

v4

v3

v6v5

+

Q. Is the graph G given below bipartite.

Bipartite graph

Page 23: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

23

Complete bipartite graph

Page 24: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Questions

24

Q1. Determine whether the graph below decomposes into copies of P4.

Q2. (Puzzle) For some n, give a graph with n vertices, n + 3 edges, and exactly 6 cycles.

Result. A graph is bipartite if and only if it has no odd cycles (will be proved in Chapter 4).

Page 25: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Hand-Shaking

25

Consider a collection of guests at a party. Suppose some guests shook hands with some other guests. If we asked everyone at the party how many guests they shook hands with and added those numbers all up, this sum would be equal to

twice the number of total hand shakes.

Is it possible that every two of them are acquainted with a different number of people in the group?(Suppose if A knows B, then B knows A.)

Page 26: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

1.6 Degrees and Regular Graphs

26

Page 27: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

27

f u or hborsis the

N(u4) = N[u4] = {u3, u4}

N(u1) = {u2, u3}

N[u1] = {u1, u2, u3}

Q. Compute N(u1), N[u1] and N(u4)

Page 28: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

28

degree sum = 12E(G) = 6

The first theorem of graph theory

Proof. Each edge contribute twice to the degree sum.

Page 29: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

29

RemarksThe null graph Nn is 0-regular.The cycle Cn is 2-regular.The complete graph Kn is (n-1)-regular.The complete (m,n)-bipartite graph Km,n is a regular graph if and only if m=n (in this case, it is m-regular).

Regular graph

Q. Compute the number of edges in k-regular graph on n vertices and the complete graph Kn . (Corollary 1.30)Every k-regular graph on n vertices has kn/2 edges. In particular, the complete graph Kn has (n – 1)n/2 edges.

Page 30: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

30

Q. Describe all 1-regular simple graphs and all 2-regular simple graphs. Show that a simple graph on an odd number of vertices cannot be 3-regular, while for every even n ≥ 4, there is a 3-regular simple graph on n vertices.

A 1-regular graph is just a disjoint union of edges.

A 2-regular graph is a disjoint union of cycles.

Suppose there is a 3-regular graph G on 2k + 1 vertices. Since 2|E(G)|=sum of the degrees=3(2k+1)=6k+3, which is a contradiction.For n = 4, K4 is the only 3-regular graph with 4 vertices. We now construct a 3-regular graph on 2m vertices, for each m ≥ 3. We take two cycles u1u2 … um, and v1v2 … vm of the same length, and we place an edge between ui and vi for each 1 ≤ i ≤ m. The resulting graph is indeed 3-regular, since ui is adjacent to ui−1, ui+1, and vi , and similarly for vi .

Q.

Page 31: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

31

Q. Every vertex of a graph G of order 14 and size 25 has degree 3 or 5. How many vertices of degree 3 does G have?

Q. A graph G of order 7 and size 10 has six vertices of degree a and one of degree b. What is b? Draw the graph G.

sol. Suppose there are x vertices of degree 3, then there are 14-x vertices of degree 5. Now |E(G)| = 25 degree sum = 50 3x + 5(14-x) = 50 x = 10

sol. 6a + b = 20 (a, b) = (0, 20) () (1, 14) () (2, 8) () (3, 2) () a=3, b=2.

Page 32: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Degree SequenceLet G=(V, E), V={v1, v2, …, vp}.

Then s: deg(v1), deg(v2), …, deg(vp) is called a degree seqence of G. For convenient, assume s is non-increasing, then s is unique.

s : 3, 3, 2, 1, 1, 0G 3 2

13

10

minimum degree d(G)

maximum degree D(G)

Page 33: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Graphical SequencesWe call a sequence of nonnegative integers graphical if it is the degree

sequence of some graph.

Theorem (Havel-Hakimi)Let s be a non-increasing sequence: d1, d2, …, dp, where di N, i, p ≥ 2, d1

≥ 1.Let s1 be the sequence:

Then s is graphical if and only if s1 is graphical.

d2-1, d3-1, …, dd1+1-1, dd1+2, …, dp

Page 34: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Q. Check if degree sequence s: 4, 4, 3, 3, 2, 2 is graphic.

s: 4, 4, 3, 3, 2, 2s1

’: 3, 2, 2, 1, 2 (delete first term (4) and subtract 1 from next 4)s1: 3, 2, 2, 2, 1 (reorder)s2: 1, 1, 1, 1 (delete first term and subtract 1 from next 3)s3

’: 0, 1, 1 (delete first term)s3: 1, 1, 0 (reorder)s4: 0, 0 (delete first term ) s is graphical

Page 35: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Algorithms: d1, d2, …, dp be the sequence of integers. To determine whether s is

graphical:

• If di = 0, i, then s is graphical. • If di<0 for some i, then s is not graphical.Otherwise, go to Step 3.• Reorder s to a non-increasing sequence, if necessary.• Delete the first number, say n, from the sequence and subtract 1 from

the next n numbers in the sequence. Return to Step 1.

Page 36: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

Q. Draw the graph for degree sequence s: 4, 4, 3, 3, 2, 2.

s4 : 0, 0 s3 : 1, 1, 0 s2 : 1, 1, 1, 1 s1 : 3, 2, 2, 2, 1 s: 4, 4, 3, 3, 2, 2

G

4

42

2 3

3

Page 37: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

s: 5, 4, 3, 2, 1, 1s1: 3, 2, 1, 0, 0 (delete 5)s2: 1, 0, -1, 0 (delete 3) s is not graphical

Q. Check if degree sequence s: 5, 4, 3, 2, 1, 1 is graphic.

Page 38: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

1.7 Subgraphs

38

is a subgraph of G if

We write G’ G.

Q. Check if G’ G.

Page 39: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

39

Induced Subgraph (Vertex-Induced Subgraph)

Q. Derive G[u1, u2, u3].

Page 40: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

40

There are 4 vertices, so there are 24 – 1 induced subgraphs.We do not consider as a subgraph.

Page 41: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

41

Edge-Induced Subgraph

Q. Derive G[e1, e2, e3, e4].

Q. Let G be a labeled (p, q) graph. How many different edge-induced subgraphs does G have?

2q-1 ( X E(G) but X )

Page 42: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

1.8 The Definition of a Directed Graph

42

u

ve

e'

Page 43: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

43

G = (V, E, h)

V = {u1, u2, u3, u4, u5}

E = {e1, e2, e3, e4, e5, e6}

Page 44: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

44

If G = (V, E, h) is a directed graph, then in a natural way we can form the corresponding underlying graph G = (V, E, ), where h (e) = (u, v) implies (e) = {u, v}.

Conversely, forming a directed graph from an undirected graph can not be done uniquely. In fact, if G has exactly m nonloop edges, then there are 2m choices for forming a directed graph G from G.

Page 45: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

45

Path digraph

Cycle digraph

Simple digraph: a digraph without directed loops and parallel directed edges.

Page 46: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

1.9 Indegrees and Outdegrees in a Digraph

46

Page 47: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

47

N +(u3) ={u1, u4}

N -(u3) ={u1, u2}

and the

Page 48: Graphs & Networks (MATH F243) · definite birth date (Oystein Ore, author of first graph theory book written in English). Graph theory is considered to have begun in 1736 with the

48

Q. Let G be a digraph in which indegree equals outdegree at each vertex. Prove that there exist a cycle in G.

A finite directed graph contains a (directed) cycle if every vertex is the tail of at least one edge (has positive outdegree). (The same conclusion holds if every vertex is the head of at least one edge.)

Let G be such a graph, let P be a maximal (directed) path in G, and let x be the final vertex of P.

Since x has at least one edge going out, there is an edge x y. Since P cannot be extended, y must belong to P. Now x y completes a cycle with the y, x­subpath of P.