Graph

15
Graph graph is a pair of two sets where – set of elements called vertices (singl. vertex) – set of pairs of vertices (elements of ) called edges • Example: where • Notation: we write for a graph with vertex set and edge set is the vertex set of , and is the edge set of 1 2 3 4 drawing of

description

Graph. graph is a pair of two sets where set of elements called vertices ( singl . vertex) set of pairs of vertices (elements of ) called edges Example: where Notation: we write for a graph with vertex set and edge set is the vertex set of , and is the edge set of. - PowerPoint PPT Presentation

Transcript of Graph

Page 1: Graph

Graph

• graph is a pair of two sets where– set of elements called vertices (singl. vertex)– set of pairs of vertices (elements of ) called edges

• Example: where

• Notation: – we write for a graph with vertex set and edge set – is the vertex set of , and is the edge set of

1

2

3 4

drawing of

Page 2: Graph

1 2 3 4

1 1 1

2 1 1

3 1 1 1

4 1

1 2 3 4

1 1 1

2 1

3 1 1

4

1 2 3 4

1 1 3

2 1 2

3 3 2 4

4 4

1 2 3 4

1 1 1

2 1 1 1

3 1 1 1 1

4 0 1

Types of graphs

• Undirected graph

set of unordered pairs

• Pseudograph (allows loops)

loop = edge between vertex and itself

1

2

3 4

• Directed graph

set of ordered pairs

• Multigraph

is a multiset

(IRREFLEXIVE) RELATIONSYMMETRIC & IRREFLEXIVE

SYMMETRIC ?

1

2

3 4

1

2

3 4

1

2

3 4

Page 3: Graph

• simple graph (undirected, no loops, no parallel edges)for edge we say:– and are adjacent– and are neighbours– and are endpoints of – we write for simplicity• = set of neighbours of in G• = degree of v is the number of its neighbours, ie

How many simple graph on vertices are there?1

23

1

23

More graph terminology

1

2

3 4

1 is adjacent to 2 and 3

1

23

1

23

1

23

1

23

1

23

1

23

1

23¿ ≠

is isomorphic to if there exists a bijective mapping such that if and only if

Page 4: Graph

1

Isomorphism

2 3

4 5 6

4

5

6

1

2

3

4

6

5

1

3

2

(3,3,3,3,3,3) (3,3,3,3,3,3) (3,3,3,3,3,3)

(3,3,3,3,2,2,2,2) (3,3,3,3,2,2,2,2)

3 3 3

3 3 3

if is an isomorphism

Page 5: Graph

Isomorphism

How many pairwise non-isomorphic graphs on vertices are there?

the complement of is the graph where

1

23

1

23

1

23

1

23

1

23

1

23

1

23

1

23

2

1

3

4

5

𝐺

2

1

3

4

5

𝐺

, ≅ self-complementary graph

Page 6: Graph

Isomorphism

• Are there self complementary graphs on 5 vertices ?

• ... 6 vertices ? No, because in a self-complementary graph and but is odd• ... 7 vertices ?• ... 8 vertices ?

2

1

3

4

5

2

1

3

4

5

4

1

5

8 7

6

2

3

No, since

Yes, there are 10

Yes, 2

Page 7: Graph

Handshake lemma

Lemma. Let be a graph with edges.

Proof. Every edge connects 2 vertices and contributes to exactly 1 to and exactly 1 to . In other words, in every edge is counted twice.

How many edges has a graph with degree sequence:- (3,3,3,3,3,3) ?- (3,3,3,3,3) ?- (0,1,2,3) ?

Corollary. In any graph, the number of vertices of odd degree is even.Corollary 2. Every graph with at least 2 vertices has 2 vertices of the same degree.

4

5

6

1

2

3

1

2

3 4

𝑚=4

Is it possible for a self-complementary graph with 100 vertices to have exactly one vertex of degree 50 ?

Answer. NoN (𝑢)50

𝑉 (𝐺)¿(𝑢)49

N 𝐺(𝑢)49

isomorphism between and

is a unique vertex of degree in

the degree seq. of and

𝑣𝑓−1

∃𝑣 , 𝑓 (𝑣 )=𝑢

we conclude

𝑓𝑢

𝑢

definition of isomorphism definition of complement

but

Page 8: Graph

Subgraphs, Paths and Cycles

Let be a graph• a subgraph of is a graph where and • an induced subgraph (a subgraph induced on ) is a graph

where • a walk (of length ) in is a sequence

where and for all • a path in is a walk where are distinct

(does not go through the same vertex twice)• a closed walk in is a walk with

(starts and ends in the same vertex)• a cycle in is a closed walk where and are distinct

1

2

3 4

1

2

3 4

2

3 4

subgraph induced subgraphon 1

2

3 4

1,{1,2},2,{2,1},1,{1,3},3is a walk (not path)

1,{1,2},2,{2,3},3,{3,1},1is a cycle

Page 9: Graph

Special graphs

• path on vertices• cycle on vertices• complete graph on vertices• hypercube of dimension

adjacent to if ’s and ’s differ in exactly once

adjacent to not adjacent to

∑𝑖=1

𝑛

|𝑎𝑖−𝑏𝑖|=1

2

1

3

4

5

21 3 4 5 𝑃5

𝐶5

2

1

3

4

5

𝐾 5

𝐵3

000

100010

001

110 111

011101

Page 10: Graph

Connectivity

• a graph is connected if for any two vertices of there exists a path (walk) in starting in and ending in

• a connected component of is a maximal connected subgraph of

1

2

3 4

1

2

3 4

connected not connected = disconnected

no path from 1 to 4

connected components1,{1,3},3,{3,4},4path from 1 to 41

3 4

Page 11: Graph

Connectivity• Show that the complement of a disconnected graph is connected !

• What is the maximum number of edges in a disconnected graph ?

• What is the minimum number of edges in a connected graph ?

𝑢𝑣

𝑢𝑣

𝐺 𝐺

(𝑘2 ) (𝑛−𝑘2 ) max𝑘 (𝑘2 )+(𝑛−𝑘2 )=(𝑛−12 )

maximum when

21 3 4 5

path on vertices has edges

cannot be less, why ? keep removing edges so long as you keep the graph connected a (spanning) tree which has edges

Page 12: Graph

Distance, Diameter and Radius

• length of a walk (path) is the number of edges• distance from a vertex to a vertex is the length of a shortest

path in between and • if no path exists define • eccentricity of a vertex is the largest distance between and

any other vertex of ; we write • diameter of is the largest distance between two vertices

• radius of is the minimum eccentricity of a vertex of

Find radius and diameter of graphs , , Prove that

recall walk (path) is a sequence of vertices and edges

if edges are clear from context we write

1

2

3 4

1

2

3 4(as witnessed by 3 called a centre)

(as witnessed by 1,4called a diametrical pair)

Page 13: Graph

Independent set and Clique

• clique = set of pairwise adjacent vertices• independent set = set of pairwise non-adjacent vertices• clique number = size of largest clique in • independence number = size of largest indepen-dent set

in

Find , , , ,

1

2

3 4

is a clique

is an independent set

21 3 4 5

𝑃5

Page 14: Graph

Bipartite graph

• a graph is bipartite if its vertex set can be partitioned into two independent sets , ; ie.,

1

2

3 41

2

3 4

1 2

34

bipartite not bipartite

1∈𝑉 1

2∈𝑉 2

3∈𝑉 2but now is notan independent set because

𝑉 1

𝑉 2

𝑉 2𝑉 1

𝐾 2,2

𝐾 3,3

𝐾 4,4 = complete bipartite graph

Which of thesegraphs are bipartite:

, , ?

𝐾 1,2

Page 15: Graph

Bipartite graphTheorem. A graph is bipartite it has no cycle of odd length.

Proof. Let . We may assume that is connected.“” any cycle in a bipartite graph is of even length

“” Assume G has no odd-length cycle. Fix a vertex and put it in . Then repeat as long as possible:- take any vertex in and put its neighbours in , or- take any vertex in and put its neighbours in .Afterwards because is connected.If one of or is not an independent set, then we find in an odd-length closed walk cycle, impossible.So, is bipartite (as certified by the partition )

2

1

3 45

𝑘...

2

1

3

2

1

3

4

5

2

1

34

56

2

3

4

1

𝑢

?

odd