Lecture 7 Graphs
Lecture 7 Graphs
INTRODUCTION TO
GRAPHS
– Simple graph
– Multigraph
– Pseudograph
– Directed graph
– Directed multigraph
– Definition 1
– Definition 2:
Washington
Denver
Los Angeles
A Computer network with multiple lines
– Definition 3:
Washington
Denver
Los Angeles
A Computer network with diagnostic lines
– Definition 4:
Washington
Denver
– Definition 5:
Washington
Denver
• Modeling graphs
Opossum Squirrel
Crow
Mouse
Woodpecker
Shrew
Linda Brian
An influence graph
CSE 504 Discrete Structures & Foundations
Dr. Djamel Bouchaffra 17
of Computer Science, Ch. 8 (part 1): Graphs
Introduction to Graphs Cont’d
– Example:
– Definition 1:
– Definition 2:
a f e g e d
G H
deg(a) 2
Solution: deg(b) deg(c) deg(f) 4 deg(a) 4
deg(b) deg(e) 6
In G deg(d) 1 In H
deg(e) 3 deg(c) 1
deg(d) 5
deg(g) 0
GRAPH TERMINOLOGY CONT’D
– Theorem 1:
Proof: Let V1 and V2 be the set of vertices of even degree and the set
of vertices of odd degree, respectively, in an undirected graph
G = (V,E). Then 2 e deg( v ) deg( v )
deg( v ).
vV vV1 vV2
Since deg(v) is even for v V1, the first term in the right-hand side of
the last equality is even. Furthermore, the sum of the two terms on
the right-hand side of the last equality is even, since this sum is 2e.
Hence, the second term in the sum is also even. Since all the terms in
this sum are odd, there must be an even number of such terms. Thus,
there are an even number of vertices of odd degree.
CSE 504 Discrete Structures & Foundations
Dr. Djamel Bouchaffra 24
of Computer Science, Ch. 8 (part 1): Graphs
GRAPH TERMINOLOGY CONT’D
– Definition 3:
– Definition 4:
In a graph with directed edges the in-degree of
a vertex v, denoted 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)
CSE 504 Discrete Structures & Foundations
Dr. Djamel Bouchaffra 26
of Computer Science, Ch. 8 (part 1): Graphs
GRAPH TERMINOLOGY CONT’D
– Example: Find the in-degree and the out-degree of each
vertex in the graph G
a b c
e f
– Theorem 3:
deg
vV
( v ) ( v ) | E | .
deg
vV
– TREE:
• Connected graph without circuits is called a tree
• Graph is called a forest when it does not have circuits
• A vertex of degree 1 is called a terminal vertex or a leaf, the
other vertices are called internal nodes
• Decision tree
• Syntactic derivation tree
• Any tree with more than one vertex has at least one vertex of
degree 1
• Any tree with n vertices has n – 1 edges
• If a connected graph with n vertices has n – 1 edges, then it is a
tree
CSE 504 Discrete Structures & Foundations
Dr. Djamel Bouchaffra 29
of Computer Science, Ch. 8 (part 1): Graphs
SUMMARY
• Graph Theory
• Simple Graph
• Connected / Unconnected Graph
• Pseudo
Contact
Phone:
Email:
[email protected] ssamnot@
hotmail.com
Skype: snorteygtuc
Website: gtuc.edu.gh