graphs

22
Graphs Basic properties 1

Upload: triage

Post on 11-Feb-2016

28 views

Category:

Documents


0 download

DESCRIPTION

Graphs. Basic properties. Applications of Graph Theory. Car navigation systems Databases Build a bot to retrieve info from Internet Representing computer networks and streams of information. Intuitive Notion of Graph. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Graphs

Graphs

Basic properties

1

Page 2: Graphs

2

Applications of Graph Theory

• Car navigation systems• Databases • Build a bot to retrieve info from Internet• Representing computer networks and streams

of information

Page 3: Graphs

Intuitive Notion of Graph

• A graph is an abstract representation of a set of objects where some pairs of the objects are connected by links. The interconnected objects are represented by mathematical abstractions called vertices, and the links that connect some pairs of vertices are called edges.

3

Page 4: Graphs

Intuitive Notion of Graph

• A graph is a bunch of vertices (or nodes) represented by circles which are connected by edges, represented by line segments

• In other words, graphs can be considered as relations on their vertices set

4

Page 5: Graphs

Definition of Graph

• A graph (an undirected or simple graph) G = (V,E ) is a nonempty finite set V (a set of vertices or nodes) together with a set E of edges, where each edge is a subset of V with cardinality 2 (an unordered pair).

• A simple graph is bidirectional (undirected) and has no loops (no “self-communication”).

5

Page 6: Graphs

6

Example

1 2

3 4

{1,2}

{3,4}

{2,4}{1,3} {2,3}

• V={1,2,3,4}• E={(1,2),(1,3),(2,3),(2,4),(3,4)}

Page 7: Graphs

7

Example

• This graph may represent a computer network• Vertices are labeled to associate with particular

computers• Each edge can be viewed as the set of its two

endpoints

1 2

3 4

{1,2}

{3,4}

{2,4}{1,3} {2,3}

Page 8: Graphs

Edges

• For a set V with n elements, how many possible edges there?

• This is the number of pairs in V - the number of 2-element subsets of V:

8

2 !, 2 1 / 22!( 2)!nnC C n n nn

Page 9: Graphs

The number of graphs

• How many possible graphs are there for the same set of vertices V ?

• The number of subsets in the set of possible edges. There are n · (n -1) / 2 possible edges, therefore the number of graphs on V is 2n(n -1)/2

9

Page 10: Graphs

10

Adjacent Vertices• Vertices are adjacent if they are the

endpoints of the same edge. This edge joins the adjacent vertices.

Q: Which vertices are adjacent to 1? How about adjacent to 2, 3, and 4?

1 2

3 4

e1

e2 e3 e4

Page 11: Graphs

11

Adjacent Vertices

1 is adjacent to 2 and 32 is adjacent to 1, 3, and 43 is adjacent to 1 and 24 is adjacent to 25 is not adjacent to any vertex

1 2

3 4

e1

e2 e3 e45

Page 12: Graphs

Incident Vertices and Edges

• A vertex is incident with an edge (and the edge is incident with the vertex) if it is the endpoint of the edge.

• Which edges are incident to 1? How about incident to 2, 3, 4, and 5?

12

1 2

3 4

e1

e2 e3 e45

Page 13: Graphs

Incident Vertices and Edges

1 is incident with e1, e2

e1, e2 are incident with 1e1, e3, e4 are incident with 22 is incident with e1, e3, e4

3 is incident with e2, e3

4 is incident with e45 is not incident with any edge

13

1 2

3 4

e1

e2 e3 e45

Page 14: Graphs

Degree of a Vertex• The number of edges incident with a vertex is

called the degree of this vertex: deg(A) is the degree of A.

• deg(1)=2; deg(2)=3; deg(3)=2; deg(4)=1; deg(5)=0• Theorem. In a graph, the sum of degrees of the

vertices equals twice the number of edges

14

1 2

3 4

e1

e2 e3 e45

Page 15: Graphs

15

Complete Graph

A simple graph is complete if every pair of distinct vertices share an edge. The notation Kn denotes the complete graph on n vertices.

K1 K2 K3 K4 K5

Page 16: Graphs

Adjacency Matrix

• For a digraph G = (V,E ) define a binary matrix AG by:

• Rows, Columns –one for each vertex in V• Value at i th row and j th column is

1 if i th vertex connects to j th vertex (i j )0 otherwise

16

Page 17: Graphs

Adjacency Matrix - Example

17

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

GA

1 2

3 4

e1

e2 e3 e4

Page 18: Graphs

Adjacency Matrix• Theorem. The sum of the entries in row i of

the adjacency matrix of a graph is the degree of the ith vertex.

18

1 2

3 4

e1

e2 e3 e40 1 1 01 0 1 1

deg(1) 2;deg(2) 3;deg(3) 2;deg(4) 11 1 0 00 1 0 0

GA

Page 19: Graphs

Graph Isomorphism

• A graph G1 is isomorphic to a graph G2, when there is a one-to-one correspondence f between the vertices of G1 and G2 such that vertices A and B are adjacent in G1 if and only if the vertices f(A) and f(B) are adjacent in G2.

• The function f is called an isomorphism of G1 with G2.

19

Page 20: Graphs

Graph Isomorphism

20

Page 21: Graphs

Graph Isomorphism Invariant

• A property is said to be a graph isomorphism invariant if, whenever G1 and G2 are isomorphic graphs and G1 has this property, then so does G2. The properties are:

has n vertices has e edges has a vertex of degree k

21

Page 22: Graphs

Homework

• Read Section 4.1• Problems (Exercises 4.1) 1, 3, 5, 7

22