• No results found

Graph theory

N/A
N/A
Protected

Academic year: 2022

Share "Graph theory"

Copied!
47
0
0

Loading.... (view fulltext now)

Full text

(1)

CS 207m 2018: Discrete Structures (Minor)

Graph theory

Bipartite graphs and their characterization, subgraphs

Lecture 15 Mar 09 2018

(2)

Topic 3: Graph theory

Topics covered in the last lecture and this one:

I What is a Graph?

I Paths, cycles, walks and trails; connected graphs.

I Eulerian graphs and a characterization in terms of degrees of vertices.

I Bipartite graphs and a characterization.

Reference: Section 1.1, 1.2 of Chapter 1 fromDouglas West.

2

(3)

Recall: Basic terminology

Definition

Asimplegraph Gis a pair (V, E) of a set of vertices/nodesV and edgesE between unordered pairs of vertices called end-points: e=vu means thateis an edge between v and u (u6=v).

I Degree d(v) of a vertexv (in an undirected loopless graph): number of edges incident to it, i.e.,|{vw∈E|w∈V}|. A vertex of degree 0 is called an isolated vertex.

I Walk: a sequence of verticesv1, . . . vk such that

∀i∈ {1, . . . k−1}, (vi, vi+1)∈E. The verticesv1 andvk are called theend-pointsand others are calledinternal vertices.

I Path: A walk in which no vertex is repeated. Itslengthis the number of edgesin it.

I Closed walk: A walk that starts and ends with the same vertex, i.e., endpoints are same.

I Cycle: A closed walk whose internal vertices are all distinct from each other and from the end-point.

I Connected graph: A graph s.t., there is a path (or walk) between any two of its vertices.

(4)

Recall: Basic terminology

I Degree d(v) of a vertexv (in an undirected loopless graph):

number of edges incident to it, i.e.,|{vw∈E|w∈V}|. A vertex of degree 0 is called an isolated vertex.

I Walk: a sequence of verticesv1, . . . vk such that

∀i∈ {1, . . . k−1}, (vi, vi+1)∈E. The verticesv1 andvk are called theend-pointsand others are calledinternal vertices.

I Path: A walk in which no vertex is repeated. Itslengthis the number of edgesin it.

I Closed walk: A walk that starts and ends with the same vertex, i.e., endpoints are same.

I Cycle: A closed walk whose internal vertices are all distinct from each other and from the end-point.

I Connected graph: A graph s.t., there is a path (or walk) between any two of its vertices.

3

(5)

Recall: Basic terminology

I Degree d(v) of a vertexv (in an undirected loopless graph):

number of edges incident to it, i.e.,|{vw∈E|w∈V}|. A vertex of degree 0 is called an isolated vertex.

I Walk: a sequence of verticesv1, . . . vk such that

∀i∈ {1, . . . k−1}, (vi, vi+1)∈E. The verticesv1 andvk are called theend-pointsand others are calledinternal vertices.

I Path: A walk in which no vertex is repeated. Itslengthis the number of edgesin it.

I Closed walk: A walk that starts and ends with the same vertex, i.e., endpoints are same.

I Cycle: A closed walk whose internal vertices are all distinct from each other and from the end-point.

I Connected graph: A graph s.t., there is a path (or walk) between any two of its vertices.

(6)

Recall: Basic terminology

I Degree d(v) of a vertexv (in an undirected loopless graph):

number of edges incident to it, i.e.,|{vw∈E|w∈V}|. A vertex of degree 0 is called an isolated vertex.

I Walk: a sequence of verticesv1, . . . vk such that

∀i∈ {1, . . . k−1}, (vi, vi+1)∈E. The verticesv1 andvk are called theend-pointsand others are calledinternal vertices.

I Path: A walk in which no vertex is repeated. Itslengthis the number of edgesin it.

I Closed walk: A walk that starts and ends with the same vertex, i.e., endpoints are same.

I Cycle: A closed walk whose internal vertices are all distinct from each other and from the end-point.

I Connected graph: A graph s.t., there is a path (or walk) between any two of its vertices.

3

(7)

Recall: Basic terminology

I Degree d(v) of a vertexv (in an undirected loopless graph):

number of edges incident to it, i.e.,|{vw∈E|w∈V}|. A vertex of degree 0 is called an isolated vertex.

I Walk: a sequence of verticesv1, . . . vk such that

∀i∈ {1, . . . k−1}, (vi, vi+1)∈E. The verticesv1 andvk are called theend-pointsand others are calledinternal vertices.

I Path: A walk in which no vertex is repeated. Itslengthis the number of edgesin it.

I Closed walk: A walk that starts and ends with the same vertex, i.e., endpoints are same.

I Cycle: A closed walk whose internal vertices are all distinct from each other and from the end-point.

I Connected graph: A graph s.t., there is a path (or walk) between any two of its vertices.

(8)

Proof of theorem on Eulerian graphs

Lemma

If every vertex of a graphG has degree at least 2, then G contains a cycle.

Theorem

A graphGwith no isolated vertices is Eulerian iff it is connected and all its vertices have even degree.

4

(9)

Proof of theorem on Eulerian graphs

Lemma

If every vertex of a graphG has degree at least 2, then G contains a cycle.

Theorem

A graphGwith no isolated vertices is Eulerian iff it is connected and all its vertices have even degree.

Proof (⇐=): By induction on number of edgesm.

I Base case: m= 1.

(10)

Proof of theorem on Eulerian graphs

Lemma

If every vertex of a graphG has degree at least 2, then G contains a cycle.

Theorem

A graphGwith no isolated vertices is Eulerian iff it is connected and all its vertices have even degree.

Proof (⇐=): By induction on number of edgesm.

I Induction step: m >1. By LemmaGhas a cycleC.

4

(11)

Proof of theorem on Eulerian graphs

Lemma

If every vertex of a graphG has degree at least 2, then G contains a cycle.

Theorem

A graphGwith no isolated vertices is Eulerian iff it is connected and all its vertices have even degree.

Proof (⇐=): By induction on number of edgesm.

I Induction step: m >1. By LemmaGhas a cycleC.

I Delete all edges in cycleC and (new) isolated vertices.

(12)

Proof of theorem on Eulerian graphs

Lemma

If every vertex of a graphG has degree at least 2, then G contains a cycle.

Theorem

A graphGwith no isolated vertices is Eulerian iff it is connected and all its vertices have even degree.

Proof (⇐=): By induction on number of edgesm.

I Induction step: m >1. By LemmaGhas a cycleC.

I Delete all edges in cycleC and (new) isolated vertices.

I GetG1, . . . , Gk. EachGi is

I connected

I has< medges.

I all its vertices have even degree (why? )

4

(13)

Proof of theorem on Eulerian graphs

Lemma

If every vertex of a graphG has degree at least 2, then G contains a cycle.

Theorem

A graphGwith no isolated vertices is Eulerian iff it is connected and all its vertices have even degree.

Proof (⇐=): By induction on number of edgesm.

I Induction step: m >1. By LemmaGhas a cycleC.

I Delete all edges in cycleC and (new) isolated vertices.

I GetG1, . . . , Gk. EachGi is

I connected

I has< medges.

I all its vertices have even degree (why? – degree of any vertex was even and removingC, reduces each vertex degree by 0 or 2.)

(14)

Proof of theorem on Eulerian graphs

Lemma

If every vertex of a graphG has degree at least 2, then G contains a cycle.

Theorem

A graphGwith no isolated vertices is Eulerian iff it is connected and all its vertices have even degree.

Proof (⇐=): By induction on number of edgesm.

I Induction step: m >1. By LemmaGhas a cycleC.

I Delete all edges in cycleC and (new) isolated vertices.

I By indn hyp, eachGi is Eulerian, has a Eulerian walk.

4

(15)

Proof of theorem on Eulerian graphs

Lemma

If every vertex of a graphG has degree at least 2, then G contains a cycle.

Theorem

A graphGwith no isolated vertices is Eulerian iff it is connected and all its vertices have even degree.

Proof (⇐=): By induction on number of edgesm.

I Induction step: m >1. By LemmaGhas a cycleC.

I Delete all edges in cycleC and (new) isolated vertices.

I By indn hyp, eachGi is Eulerian, has a Eulerian walk.

I Combine the cycleC and the Eulerian walk ofG1, . . . , Gk to produce an Eulerian walk ofG(how?).

(16)

Proof of theorem on Eulerian graphs

Lemma

If every vertex of a graphG has degree at least 2, then G contains a cycle.

Theorem

A graphGwith no isolated vertices is Eulerian iff it is connected and all its vertices have even degree.

Proof (⇐=): By induction on number of edgesm.

I Induction step: m >1. By LemmaGhas a cycleC.

I Delete all edges in cycleC and (new) isolated vertices.

I By indn hyp, eachGi is Eulerian, has a Eulerian walk.

I Combine the cycleC and the Eulerian walk ofG1, . . . , Gk

to produce an Eulerian walk ofG(how?).

I Traverse along cycleC inGand when someGiis entered for first time, detour along an Eulerian walk ofGi.

I This walk ends at vertex where we started detour.

I When we complete traversal ofC in this way, we have completed an Eulerian walk onG.

4

(17)

Application of Eulerian graphs

Another application of Eulerian graphs

If we want to draw a given connected graphGon paper, how many times must we stop and move the pen? No segment should be drawn twice.

I This is the number of walks with no repeated edges into which it can be decomposed.

I Walks with no repeated edges are calledtrails.

(18)

Application of Eulerian graphs

Another application of Eulerian graphs

If we want to draw a given connected graphGon paper, how many times must we stop and move the pen? No segment should be drawn twice.

I This is the number of walks with no repeated edges into which it can be decomposed.

I Walks with no repeated edges are calledtrails.

I So, given a connected graph with |V|>1 how many trails can it be decomposed into?

5

(19)

Application of Eulerian graphs

Another application of Eulerian graphs

If we want to draw a given connected graphGon paper, how many times must we stop and move the pen? No segment should be drawn twice.

I This is the number of walks with no repeated edges into which it can be decomposed.

I Walks with no repeated edges are calledtrails.

I So, given a connected graph with |V|>1 how many trails can it be decomposed into? half of the odd vertices?

(20)

Application of Eulerian graphs

Another application of Eulerian graphs

If we want to draw a given connected graphGon paper, how many times must we stop and move the pen? No segment should be drawn twice.

I This is the number of walks with no repeated edges into which it can be decomposed.

I Walks with no repeated edges are calledtrails.

I So, given a connected graph with |V|>1 how many trails can it be decomposed into? half of the odd vertices?

I can a graph have 2k+ 1 odd vertices?

5

(21)

Application of Eulerian graphs

Another application of Eulerian graphs

If we want to draw a given connected graphGon paper, how many times must we stop and move the pen? No segment should be drawn twice.

I This is the number of walks with no repeated edges into which it can be decomposed.

I Walks with no repeated edges are calledtrails.

I So, given a connected graph with |V|>1 how many trails can it be decomposed into? half of the odd vertices?

I can a graph have 2k+ 1 odd vertices?

Theorem

For a connected graph with|V|>1 and exactly 2kodd vertices, the minimum number of trails that decompose it is max{k,1}.

(22)

Application of Eulerian graphs

Theorem

For a connected graph with|V|>1 and exactly 2kodd vertices, the minimum number of trails that decompose it is max{k,1}.

Proof idea: We will show that(i) at least these many trails are requiredand (ii) these many trails suffice.

I A trail touches each vertex an even no. of times, except if the trail is not closed, then the endpoints are touched odd no. of times

5

(23)

Application of Eulerian graphs

Theorem

For a connected graph with|V|>1 and exactly 2kodd vertices, the minimum number of trails that decompose it is max{k,1}.

Proof idea: We will show that(i) at least these many trails are requiredand (ii) these many trails suffice.

I A trail touches each vertex an even no. of times, except if the trail is not closed, then the endpoints are touched odd no. of times

I i.e., if we partitionGinto trails, each odd vertex inG must have a non-closed walk starting or ending at it.

(24)

Application of Eulerian graphs

Theorem

For a connected graph with|V|>1 and exactly 2kodd vertices, the minimum number of trails that decompose it is max{k,1}.

Proof idea: We will show that(i) at least these many trails are requiredand (ii) these many trails suffice.

I A trail touches each vertex an even no. of times, except if the trail is not closed, then the endpoints are touched odd no. of times

I i.e., if we partitionGinto trails, each odd vertex inG must have a non-closed walk starting or ending at it.

I Each trail has only 2 ends implies we use at leastktrails to satisfy 2kodd vertices.

5

(25)

Application of Eulerian graphs

Theorem

For a connected graph with|V|>1 and exactly 2kodd vertices, the minimum number of trails that decompose it is max{k,1}.

Proof idea: We will show that(i) at least these many trails are requiredand (ii) these many trails suffice.

I A trail touches each vertex an even no. of times, except if the trail is not closed, then the endpoints are touched odd no. of times

I i.e., if we partitionGinto trails, each odd vertex inG must have a non-closed walk starting or ending at it.

I Each trail has only 2 ends implies we use at leastktrails to satisfy 2kodd vertices.

I We need at least one trail sinceG has an edge.

(26)

Application of Eulerian graphs

Theorem

For a connected graph with|V|>1 and exactly 2kodd vertices, the minimum number of trails that decompose it is max{k,1}.

Proof idea: We will show that(i) at least these many trails are requiredand (ii) these many trails suffice.

I A trail touches each vertex an even no. of times, except if the trail is not closed, then the endpoints are touched odd no. of times

I i.e., if we partitionGinto trails, each odd vertex inG must have a non-closed walk starting or ending at it.

I Each trail has only 2 ends implies we use at leastktrails to satisfy 2kodd vertices.

I We need at least one trail sinceG has an edge.

I Thus, we have shown that at least max{k,1}trails are required.

5

(27)

Application of Eulerian graphs

Theorem

For a connected graph with|V|>1 and exactly 2kodd vertices, the minimum number of trails that decompose it is max{k,1}.

Proof idea: We will show that (i) at least these many trails are required and(ii) these many trails suffice.

I If k= 0, one trail suffices (i.e., an Eulerian walk by previous Thm)

(28)

Application of Eulerian graphs

Theorem

For a connected graph with|V|>1 and exactly 2kodd vertices, the minimum number of trails that decompose it is max{k,1}.

Proof idea: We will show that (i) at least these many trails are required and(ii) these many trails suffice.

I If k= 0, one trail suffices (i.e., an Eulerian walk by previous Thm)

I If k >0 we need to prove that ktrails suffice.

I Pair up odd vertices inG(in any order) and formG0 by adding an edge between them.

I G0 is connected, by previous Thm has an Eulerian walkC.

I TraverseC inG0 and for each time we cross an edge ofG0 not inG, start a new trail (lift pen!).

I Thus, we getktrails decomposingG.

5

(29)

Some simple types of Graphs

I We have already seen some: connected graphs.

I paths, cycles.

I Are there other interesting classes of graphs?

(30)

Some simple types of Graphs

I We have already seen some: connected graphs.

I paths, cycles.

I Are there other interesting classes of graphs?

6

(31)

Some simple types of Graphs

I We have already seen some: connected graphs.

I paths, cycles.

I Are there other interesting classes of graphs?

(32)

Bipartite graphs

Definition

A graph is calledbipartite, if the vertices of the graph can be partitioned intoV =X∪Y,X∩Y =∅ s.t., ∀e= (u, v)∈E,

I either u∈X and v∈Y

I orv∈X and u∈Y

Example: m jobs andnpeople, kcourses and `students.

I How can we check if a graph is bipartite?

I Can we characterize bipartite graphs?

7

(33)

Bipartite graphs

Definition

A graph is calledbipartite, if the vertices of the graph can be partitioned intoV =X∪Y,X∩Y =∅ s.t., ∀e= (u, v)∈E,

I either u∈X and v∈Y

I orv∈X and u∈Y

Example: m jobs andnpeople, kcourses and `students.

I How can we check if a graph is bipartite?

I Can we characterize bipartite graphs?

(34)

Bipartite graphs

We will use cycles to characterize them.

8

(35)

Bipartite graphs

We will use cycles to characterize them.

I Recall: A path or a cycle has length nif the number of edges in it is n.

I A path (or cycle) is call odd (or even) if its length is odd (or even, respectively).

(36)

Bipartite graphs

We will use cycles to characterize them.

I Recall: A path or a cycle has length nif the number of edges in it is n.

I A path (or cycle) is call odd (or even) if its length is odd (or even, respectively).

Lemma

Every closed odd walk contains an odd cycle.

8

(37)

Bipartite graphs

We will use cycles to characterize them.

I Recall: A path or a cycle has length nif the number of edges in it is n.

I A path (or cycle) is call odd (or even) if its length is odd (or even, respectively).

Lemma

Every closed odd walk contains an odd cycle.

Proof: By induction on the length of the given closed odd walk.

(Class work; see section 1.2 of Douglas West).

(38)

Bipartite graphs

We will use cycles to characterize them.

I Recall: A path or a cycle has length nif the number of edges in it is n.

I A path (or cycle) is call odd (or even) if its length is odd (or even, respectively).

Lemma

Every closed odd walk contains an odd cycle.

Proof: By induction on the length of the given closed odd walk.

(Class work; see section 1.2 of Douglas West).

What about closed even walks?

8

(39)

Characterizing bipartite graphs using cycles.

Lemma

Every closed odd walk contains an odd cycle.

(40)

Characterizing bipartite graphs using cycles.

Lemma

Every closed odd walk contains an odd cycle.

Theorem, Konig, 1936

A graph is bipartite iff it has no odd cycle.

Proof:

9

(41)

Characterizing bipartite graphs using cycles.

Lemma

Every closed odd walk contains an odd cycle.

Theorem, Konig, 1936

A graph is bipartite iff it has no odd cycle.

Proof:

I ( =⇒) direction is easy.

(42)

Characterizing bipartite graphs using cycles.

Lemma

Every closed odd walk contains an odd cycle.

Theorem, Konig, 1936

A graph is bipartite iff it has no odd cycle.

Proof:

I ( =⇒) direction is easy.

I Let Gbe bipartite with (V =X∪Y). Then, every walk in G alternates betweenX, Y.

9

(43)

Characterizing bipartite graphs using cycles.

Lemma

Every closed odd walk contains an odd cycle.

Theorem, Konig, 1936

A graph is bipartite iff it has no odd cycle.

Proof:

I ( =⇒) direction is easy.

I Let Gbe bipartite with (V =X∪Y). Then, every walk in G alternates betweenX, Y.

=⇒ if we start fromX, each return to X can only happen after an even number of steps.

=⇒ G has no odd cycles.

(44)

Characterizing bipartite graphs using cycles.

Lemma

Every closed odd walk contains an odd cycle.

Theorem, Konig, 1936

A graph is bipartite iff it has no odd cycle.

Proof:

I (⇐=) Suppose Ghas no odd cycle, then let us construct the bipartition. Wlog assumeG is connected.

9

(45)

Characterizing bipartite graphs using cycles.

Lemma

Every closed odd walk contains an odd cycle.

Theorem, Konig, 1936

A graph is bipartite iff it has no odd cycle.

Proof:

I (⇐=) Suppose Ghas no odd cycle, then let us construct the bipartition. Wlog assumeG is connected.

I Let u∈V. BreakV into

X ={vV | length of shortest pathPuv fromuto vis even}, Y ={vV | length of shortest pathPuv fromuto vis odd},

(46)

Characterizing bipartite graphs using cycles.

Lemma

Every closed odd walk contains an odd cycle.

Theorem, Konig, 1936

A graph is bipartite iff it has no odd cycle.

Proof:

I (⇐=) Suppose Ghas no odd cycle, then let us construct the bipartition. Wlog assumeG is connected.

I Let u∈V. BreakV into

X ={vV | length of shortest pathPuv fromuto vis even}, Y ={vV | length of shortest pathPuv fromuto vis odd},

I If there is an edge vv0 between two vertices ofX or two vertices of Y, this creates a closed odd walk: uPuvvv0Pv0uu.

9

(47)

Characterizing bipartite graphs using cycles.

Lemma

Every closed odd walk contains an odd cycle.

Theorem, Konig, 1936

A graph is bipartite iff it has no odd cycle.

Proof:

I (⇐=) Suppose Ghas no odd cycle, then let us construct the bipartition. Wlog assumeG is connected.

I Let u∈V. BreakV into

X ={vV | length of shortest pathPuv fromuto vis even}, Y ={vV | length of shortest pathPuv fromuto vis odd},

I If there is an edge vv0 between two vertices ofX or two vertices of Y, this creates a closed odd walk: uPuvvv0Pv0uu.

I By Lemma, it must contain an odd cycle: contradiction.

I This along with X∩Y =∅ andX∪Y =V, impliesX, Y is a bipartition.

References

Related documents

I For k &gt; 0, every k-regular bipartite graph (i.e, every vertex has degree exactly k) has a perfect matching.!. If every

I The vertices incident to edges in a matching are called matched or saturated.3. Matchings in

In the report, we study Mader’s theorem [1], proof of which helps us to get d internally vertex disjoint paths between end vertices of an edge of a graph G with minimum degree at

If a strong digraph has minimum outdegree at least 3, except possibly for three vertices and, if we remove any vertex all the remaining vertices are still reachable from a vertex v 1

A graph is called Eulerian if it has a closed walk that contains all edges, and each edge occurs exactly once.. Such a walk is called an

A graph G=&lt;V, E&gt; is said to be a simple graph if it does not contain parallel edges. For the following graph determine the indegree, outdegree and

If the graph is Open Eulerian then pick any of the two odd degree vertices as start vertex and find Eulerian trail by applying the above mentioned algorithm.. If the graph is

Clique problems include: finding the maximum clique (a clique with the largest number of vertices),finding a maximum weight clique in a weighted graph, listing