You are on page 1of 112

Problem

Problems
• Solution
Logic Propositional calculus
Logical identities
Graphs
DEFINITION 1
• A graph G = ( V , E) consists of V, a nonempty set of
vertices and E, a set of edges.
• Each edge has either one or two vertices associated
with it, called its endpoints.
• An edge is said to connect its endpoints.
• A graph with an infinite vertex set is called an infinite
graph.
• a graph with a finite vertex set is called a finite graph.

L Al-zaid Math1101 27
Basic Terminology
DEFINITION 1
• Two vertices u and v in an undirected graph G
are called adjacent in G if u and v are
endpoints of an edge of G .
• The vertices u and v are called endpoints of an
edge associated with { u , v}.

28 L Al-zaid Math1101
Basic Terminology
DEFINITION 1
• Two vertices u and v in an undirected graph G
are called adjacent in G if u and v are
endpoints of an edge of G .
• The vertices u and v are called endpoints of an
edge associated with { u , v}.

29 L Al-zaid Math1101
‫‪30‬‬ ‫أ‪ .‬زينب آل كاظم‬
Example 1:
What are the degrees of the vertices in the graphs G and H displayed in Figure 1?

Solution:
In G:
deg(a) = , deg(b) = , deg(c) = , deg(f ) = ,
deg(d ) = , deg(e) = , and deg(g) = .
In H:
deg(a) = , deg(b) = , deg(e) = ,
deg(c) = , and deg(d ) = .
31 L Al-zaid Math1101
• A vertex of degree zero is called isolated.
• It follows that an isolated vertex is not
adjacent to any vertex.
• Vertex g in graph G in Example 1 is isolated.
• A vertex is pendant if and only if it has degree
one.
• Consequently, a pendant vertex is adjacent to
exactly one other vertex.
• Vertex d in graph G in Example 1 is pendant.

32 L Al-zaid Math1101
THEOREM 1
Let G = (V, E) be an undirected graph with e
edges. Then 2e = ∑vϵV deg(v).
(Note that this applies even if multiple edges
and loops are present.)

33 L Al-zaid Math1101
THEOREM 2
An undirected graph has an even number of
vertices of odd degree.

34 L Al-zaid Math1101
DEFINITION 3
• When (u ,v) is an edge of the graph G with
directed edges, u is said to be adjacent to v
and v is said to be adjacent from u.
• The vertex u is called the initial vertex of
(u,v), and v is called the terminal or end
vertex of (u,v).
• The initial vertex and terminal vertex of a loop
are the same.

35 L Al-zaid Math1101
In-degree & Out-degree
DEFINITION 4
• In a graph with directed edges the in-degree of a
vertex v, denoted by deg- (v), is the number
of edges with v as their terminal vertex.
• The out-degree of v, denoted by deg+(v), is the
number of edges with v as their initial vertex.
• (Note that a loop at a vertex contributes 1 to
both the in-degree and the out-degree of this vertex.)

L Al-zaid Math1101 38
THEOREM 3
Let G = (V,E) b e a graph with directed edges. Then:
∑vϵV deg-(v)= ∑vϵV deg+(v)=|E|.

L Al-zaid Math1101 40
Paths
Informally, a path is a sequence of edges that begins at a vertex of a
graph and travels from vertex to vertex along edges of the graph.
Definition 1
• Let n be a nonnegative integer and G an undirected graph. A path
of length n from u to v in G is a sequence of n edges e 1 , . . . , en of
G such that e1 is associated with {x0, x1}, e2 is associated with {X1 ,
X2 } , and so on, with en associated with {xn-1 , xn }, where X0= u and
Xn=v.
• When the graph is simple, we denote this path by its vertex
sequence X0,X1,…, Xn (because listing these vertices uniquely
determines the path).
The path is a circuit if it begins and ends at the same vertex, that is,
if u = v, and has length greater than zero.
• The path or circuit is said to pass through the vertices X1 , X2 , . . . ,
Xn-l or traverse the edges e1 , e2 , . . . , en .
• A path or circuit is simple if it does not contain the same edge
more than once. L Al-zaid Math1101 41
Example
Problem

solution
Walk
Remark
Consider the following graph-
 

 
Decide which of the following sequences of vertices determine walks.
For those that are walks, decide whether it is a circuit, a path, a cycle or a trail.
1. a , b , g , f , c , b
2.b , g , f , c , b , g , a
3.c , e , f , c
4.c , e , f , c , e
5.a , b , f , a
6.f , d , e , c , b
 
Solution-
 
7.Trail
2.Walk
3.Cycle
4.Walk
5. Not a walk
6. Path
 
Adjacency Matrix
Planar graph
• DEFINITION
• A graph is called planar if it can be drawn in the plane without any
edges crossing (where
• a crossing of edges is the intersection of the lines or arcs representing
them at a point other
• than their common endpoint). Such a drawing is called a planar
representation of the graph.
• Is K4 planar

• Solution: K4 is planar because it can be drawn without crossings


Is Q3, planar?
Euler Formula
Example
• Which of the following graphs has an
Euler path?
a b a b a b

e e

d c d c c d e

yes no yes
(a, e, c, d, e, b, a ) (a, c, d, e, b, d, a, b)
Euler Graph
• Euler circuit is a circuit that contains every vertex and every edge of a graph.
Every edge is traversed exactly once.
• If a graph has Euler circuit then every vertex has even degree. If some vertex of a
graph has odd degree then the graph does not have an Euler circuit
• If every vertex of a graph has even degree and the graph is connected then the
graph has an Euler circuit
• A Euler path is a path between two vertices that contains all vertices and
traverses all edge exactly ones
• There is an Euler path between two vertices v and w iff vertices v and w have
odd degrees and all other vertices have even degrees
Example
• Which of the following graphs has an
Euler circuit?
a b a b a b

e e

d c d c c d e

yes no no
(a, e, c, d, e, b, a)
Euler Circuit in Directed Graphs

NO (a, g, c, b, g, e, d, f, a) NO
DEFINITION 1
A tree is a connected undirected graph with no simple circuits.
Because a tree cannot have a simple circuit, a tree cannot
contain multiple edges or loops. Therefore any tree must be a
simple graph.

79 L Al-zaid Math1101
Forests
Any connected graph that contains no simple circuits is a tree.
What about graphs containing no simple circuits that are not necessarily
connected?
These graphs are called forests and have the property that each of their
connected components is a tree.

L Al-zaid Math1101 81
The Root & Rooted Trees
In many applications of trees, a particular vertex of a tree is designated as the
root.
Because there is a unique path from the root to each vertex of the graph (by
Theorem1), we direct each edge away from the root.
Thus, a tree together with its root produces a directed graph called a rooted
tree.

L Al-zaid Math1101 82
Rooted Tree
DEFINITION 2
A rooted tree is a tree in which one vertex has been designated as the
root and every edge is directed away from the root.

L Al-zaid Math1101 83
Spanning tree
Let be a connected graph with vertex set V. A spanning tree in is a •
.subgraph which is a tree and has vertex set V
Spanning Trees
• A subgraph T of a graph G is called a spanning tree when T is a tree
and contains all vertices of G
• Every connected graph has a spanning tree
• Any two spanning trees have the same number of edges
• A weighted graph is a graph in which each edge has an associated real
number weight
• A minimal spanning tree (MST) is a spanning tree with the least total
weight of its edges
Theorem
Theorem
Graph Colouring

Graph Colouring Problem:


Given a graph, colour all the vertices so that
two adjacent vertices get different colours.

Objective: use minimum number of colours.

3-colourable
Optimal Colouring

Definition. min #colors for G is chromatic number, (G)

What graphs have chromatic number one?

when there are no edges…

What graphs have chromatic number 2?

What graphs have chromatic number larger than 2?

A path? A cycle? A triangle?


Wheels

W5
 (Wodd ) = 4  (Weven ) = 3

You might also like