graphs_ii

5
ECNG2013 LECTURE 11 Graphs and Trees (II) Definitions A simple graph is a graph with no loops or parallel edges. In a simple graph, an edge with endpoints v and w is denoted by [v, w]. (v, w) is used to denote a directed edge from v to w. A graph H is said to be a subgraph of a graph G if and only if, every vertex in H is also a vertex in G, every edge in H is also an edge in G, and every edge in H has the same end points as in G. Let G be a graph and v a vertex of G. Then the degree of v denoted by deg(v) equals the number of edges that are incident on v, with an edge that is a loop counted twice. The total degree of G is the sum of the degrees of all the vertices of g. Example Draw a simple graph connecting the five vertices , , , and Draw two subgraphs of G

Upload: marlon-boucaud

Post on 14-Jul-2016

41 views

Category:

Documents


0 download

DESCRIPTION

Math

TRANSCRIPT

Page 1: Graphs_II

ECNG2013LECTURE 11

Graphs and Trees (II)

Definitions A simple graph is a graph with no loops or parallel edges. In a simple graph, an edge with

endpoints v and w is denoted by [v, w]. (v, w) is used to denote a directed edge from v to w. A graph H is said to be a subgraph of a graph G if and only if, every vertex in H is also a vertex in

G, every edge in H is also an edge in G, and every edge in H has the same end points as in G. Let G be a graph and v a vertex of G. Then the degree of v denoted by deg(v) equals the number

of edges that are incident on v, with an edge that is a loop counted twice. The total degree of G is the sum of the degrees of all the vertices of g.

ExampleDraw a simple graph connecting the five vertices , , , andDraw two subgraphs of G

Theorem

Page 2: Graphs_II

If G is any graph, then the sum of the degrees of all the vertices of G equals twice the number of edges of G.

ProofLet G be any particular but arbitrarily chosen graph. If G does not have any vertices, then it does not have any edges and so theorem is true since 2 X 0 = 0.Suppose G has n vertices, , , ........, , and m edges, one can claim that each edge of G contributes 2 to the total degree of G.For instance, if e is an arbitrarily chosen edge with end points and , this edge contributes 1 to the

degree of and 1to the degree of . If i = j, because an edge that is now a loop is counted twice in computing the degree of the vertex on which it is incident, proposition is also true there.It therefore follows that claim that e contributes 2 to the total degree of G is true. Since e is arbitrarily chosen, this shows that it is also true for each edge of G.Hence total degree of G = 2 x Number of edges of G.

Walks, Paths, Trails, CircuitsDefinitionsLet G be a graph and v and w be vertices of G

A walk from v to w is a finite alternating sequence of adjacent vertices and edges of G. Thus a walk has the form where =w and =v. If the beginning vertex is the same as the ending vertex, we say that the walk is closed. The length of the walk is the number of edges in the walk. A walk of length 0 is called a trivial walk.

A trail from v to w is a walk from v to w that does not contain a repeated edge A path is a walk with no repeated vertices A circuit is a closed trail. A cycle is a non trivial circuit in which the only repeated vertex is the first and last A Hamiltonian circuit for a graph G is a cycle that includes every vertex of G.

i.e. It is a sequence of adjacent vertices and distinct edges in which every vertex of G appears exactly once except for the first and the last.

DefinitionLet G be a graph. Then G is Eulerian if there is a circuit in G that involves every edge exactly once. This circuit is called an Eulerian circuit

TheoremA graph G has an Euler circuit if, and only if, G is connected and every vertex of G has an even degree

ProofSuppose that G is a graph that has an Euler circuit. Let v stand for any arbitrarily chosen vertex of G. Since the Euler circuit contains every edge of G, it contains all the edges incident on v.

Page 3: Graphs_II

Suppose you take a journey that begins in the middle of one of the edges adjacent to the start of the Eulerian circuit and continues around the Euler circuit to the end in the middle of the starting edge. Each time v is entered by travelling along one edge it is immediately exited by travelling along another edge.Because the Euler circuit uses every edge of G exactly once, every edge incident on v is traversed exactly once in this process. Hence the edges incident on v occur in entry exit pairs and consequently the degree of v must be a multiple of two. Hence the degree of v is even.

Example

1

2 8

3 7

4 6

5

(a) Find two different circuits each with a length of 7 that begin and end at 1(b) Find a walk from 1 to 8 that uses five edges and is not a trail.(c) Find a trail from 3 to 5 that uses all the edges incident with 4(d) Find a Hamiltonian circuit starting and ending at 8(e) Find a cycle of length 4

TheoremA connected non Eulerian graph has an Eulerian trail if, and only if, G has exactly two nodes of odd degree. Moreover, the trail must begin and end at these two nodes.

ExampleFind an Eulerain trail for the graph below

Add an edge to make the graph Eulerian

1

2 56

Page 4: Graphs_II

3 4

ExampleThe graph below is a map showing four cities and the distance in km between them. Suppose that a salesman must travel to each city exactly once starting and ending in city a. Which route from city to city will minimize the total distance that must be travelled.

B 30 C30 50

A 35 25

40 D

Solution The problem can be solved by writing all possible Hamiltonian circuits starting and ending at A and calculating the total distance travelled for each.

1. ABCDA - 30 + 30 + 25 + 40 = 1252. ABDCA - 30 + 35 + 25 + 50 = 1403. ACBDA – 50 + 30 + 35 + 40 = 1554. ACDBA – 50 + 25 + 30 + 40 = 1405. ADBCA – 40 + 35 + 30 + 50 = 1556. ADCBA – 40 +25 + 30 +30 =125

Hence either route ABCDA or ADCBA gives a minimum total distance of 125 km.