0% found this document useful (0 votes)
3 views41 pages

L Graph I

This lecture covers the fundamentals of graph theory, including definitions of various types of graphs such as undirected, directed, simple, multigraphs, and pseudographs. It discusses graph models like acquaintanceship, influence, and precedence graphs, along with key terminologies such as adjacent vertices and the degree of a vertex. Additionally, it introduces the Handshaking Theorem and concepts of directed degree, providing examples and exercises for further understanding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views41 pages

L Graph I

This lecture covers the fundamentals of graph theory, including definitions of various types of graphs such as undirected, directed, simple, multigraphs, and pseudographs. It discusses graph models like acquaintanceship, influence, and precedence graphs, along with key terminologies such as adjacent vertices and the degree of a vertex. Additionally, it introduces the Handshaking Theorem and concepts of directed degree, providing examples and exercises for further understanding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 41

Lecture 25

Lecture Outline
• Graphs
– Undirected Graph
– Directed Graph
– Graph Models
– Graph Terminologies
– Degree of a vertex

06/13/2025 CSC102 - Discrete Structures 2


Graphs

• What are graphs?


– A class of discrete structures useful for representing relations
among objects.
– Vertices (nodes) connected by edges.
– Theory about graphs can be used to solve a lot of important
problems
The First Graph Theory
– The first graph theory paper by Leonhard Euler in 1736
– Seven bridges of Königsberg, A town with 7 bridges and 4
pieces of land…
The Origin of Graph Theory
• Can we travel each bridge exactly once and
return to the starting point?
Graphs

• Graph
– Directed
– Undirected
Graphs

• Graph
• Directed Edge Un-directed
Edge

a b a b
terminal
Initial
vertex
vertex
Ordered pair Un-ordered pair
( a, b) {a, b}

7
Definition - Graphs
– A graph G = (V, E) is defined by a set of vertices V , and a set of
edges E consisting of ordered or unordered pairs of vertices
from V.
– Thus a graph G = (V, E)
• V = set of vertices
• E = set of edges = subset of V  V

• Each edge has either one or two vertices


associated with it, called its endpoints.
• An edge is said to connect its endpoints.

8
Graphs
Graphs
Simple Graphs

– A graph in which each edge connects two different vertices and


where no two edges connect the same pair of vertices.
Example
Multigraph
• A multigraph: multiple edges
connecting the same nodes

• E.g., nodes are cities, edges are

segments of major highways.


Pseudographs
– Pseudograph: Like a multigraph, but edges connecting a node
to itself are allowed.
Directed Graphs

– A directed graph (or digraph) (V,E) consists of a set of vertices V


and a set of directed edges E on V. Each directed edge is
associated with an ordered pair of vertices. The directed edge
associated with the ordered pair (u,v) is said to start at u and
end at v.
Simple Directed Graph

A directed graph that has no loops and has no multiple


directed edges is called a simple directed graph.
Directed Multigraphs
– A directed multigraph has directed parallel edges.

06/13/2025 CSC102 - Discrete Structures 17


Types of Graphs: Summary
– Summary of the book’s definitions.
– Keep in mind these terminology is not fully standardized
across different authors...
Type Edges Multiple Edges Loops
Allowed? Allowed?
Simple Graphs Undirected No No
Multigraph Undirected Yes No
Pseudograph Undirected Yes Yes
Simple directed Directed No No
graph
Directed Directed Yes Yes
multigraph
Graph Models: Acquaintanceship Graph

– Represent whether two people know each other, that is, whether
they are acquainted.
– Each person in a particular group of people is represented by a
vertex.
– Undirected edge is used to connect two people when these people
know each other.
– No multiple edges are used.

– Usually no loops are used. (If we want to include the notion of self-
knowledge, we would include loops.)
Example
Graph Models: An Influence Graph

– A directed edge (a, b) means a can influence b.


– E.g. (Fred, Brian) means Fred can influence Brian.
Example

• Construct an influence graph for the board members of a


company if the President can influence the Director of Research
and Development, the Director of Marketing and the Director of
Operations; the Director of Research and Development can
influence the Director of Operations; the Director of Marketing
can influence the Director of Operations; and no one can
influence, or be influenced by, the Chief Financial Officer.
Graph Models: Round Robin Tournaments

– A tournament where each team plays each other team exactly


once.
– Such tournaments can be modeled using directed graphs
where each team is represented by a vertex. Note that (a, b)
is an edge if team ‘a’ beats team ‘b’. This graph is a simple
directed graph, containing no loops or multiple directed
edges.
Example

Team 1 is undefeated in this tournament, and Team 3 is


winless.
Graph Models: Intersection Graph
– The intersection graph of a collections of sets is the
graph that has a vertex for each of these sets and has
an edge connecting the vertices representing two
sets if these sets have a non empty intersection.
Example

– Draw an edge if intersection is not empty.


– E.g.
A1 A2

A3
A4
Graph Models: Precedence graph
• Each statement is represented by a vertex
• There is an edge from one statement to a second
statement if the second statement cannot be executed
before the first statement.
Graph Terminologies

– Adjacent:
Let G be an undirected graph with edge set E. Let e ∈ E be (or map
to) the pair {u,v}. Then we say:

– u, v are adjacent / neighbors / connected.


– Edge e is incident with vertices u and v.
– Edge e connects u and v.
– Vertices u and v are endpoints of edge e.
Degree of a Vertex

– Let G be an undirected graph, v ∈ V a vertex.


– The degree of v, deg(v), is its number of incident edges.
(Except that any self-loops are counted twice.)

deg(a) = 3
deg(b) = 5
deg(c) = 5
deg(d) = 5
deg(e) = 0 (isolated vertex)

Pendant vertex = with degree 1

G1
Example
• What is the degree of each vertex of the following graph?

A1 A2

A3
A4

deg(A1) = 2 deg(a) = 4
deg(A2) = 3 deg(b) = 6
deg(A3) = 2 deg(c) = 1
deg(A4) = 3 deg(d) = 5
deg(e) =6
Handshaking Theorem
– Let G be an undirected (simple, multi-, or pseudo-) graph with
vertex set V and edge set E. Then

 deg(v) 2 E
vV

 deg(v) deg(a)  deg(b)  deg(c)  deg(d )  deg(e) 18 2 | E |


v{a ,b ,c , d ,e}

• deg(a)=3, deg(b)=5, deg(c)=5, deg(d)=5, deg(e)=0


Example

deg(a) = 3 deg(a) = 4
deg(b) = 5 deg(b) = 6
deg(c) = 5 deg(c) = 1
deg(d) = 5 deg(d) = 5
deg(e) =0 deg(e) =6

Total degree=18 Total degree=22


=2(9) =2(11)
Edges =9 Edges =11
Example
• How many edges are there in a graph with 10
vertices each of degree six?
Edges=10*6= 60=2(30)=2(E)

• If a graph has 5 vertices, can each vertex have


degree 3?
Edges=5*3= 15 cant be represented s multiple of 2,
Therefore Graph not possible
Handshaking Theorem
– Any undirected graph has an even number of vertices of odd
degree.
– Let and be the set of vertices of even and odd degrees
respectively, in an undirected graph, then
2e  deg(v)  deg(v)   deg(v)
vV vV1 vV2

must be even because 2e is


must be even even and first Sum for v1 is
since deg(v) is already even, therefore this term
even for each v must also result in even number.
∈ V1 Because all the terms in
– || has to be even. this sum are odd, there must be
an even number of such terms.
Thus, there are an even number
of vertices of odd degree.
Example

2 vertices with 4 vertices with 2 vertices with


odd degree odd degree odd degree

deg(A1) = 2 deg(a) = 3 deg(a) = 4


deg(A2) = 3 deg(b) = 5 deg(b) = 6
deg(A3) = 2 deg(c) = 5 deg(c) = 1
deg(A4) = 3 deg(d) = 5 deg(d) = 5
deg(e) =0 deg(e) =6
Directed Degree

– When is an edge of the graph G with directed edges, is said


to be adjacent to . The vertex is called the initial vertex of ,
and is called the terminal or end vertex of
– The initial vertex and terminal vertex of a loop are the same.
Directed Degree

– Let G be a directed graph, v a vertex of G.

– The in-degree of v, , is the number of edges with as their


terminal vertex.
– The out-degree of v, , is the number of edges with as their
initial vertex.
– The degree of v, is the sum of v’s in-degree and out-degree.

– Loop at a vertex contributes 1 to both the in-degree and the


out-degree of this vertex.
Example

– Determine in/out-degree of each vertex of Graph G.


Example

– Determine in/out-degree of each vertex of Graph G.


in- degree out - degree
deg  (a) 2 deg  (a) 4
deg  (b) 2 deg  (b) 1
deg  (c) 3 deg  (c) 2
deg  (d ) 2 deg  (d ) 2
deg  (e) 3 deg  (e) 3
deg  ( f ) 0 deg  ( f ) 0
Total 12 Total 12
Theorem
• Let be a graph with directed edges then

 deg 
(v)   deg (v)  E

• The first
vV
sum countsvVthe number of incoming
edges over all vertices and the second sum
counts the number of outgoing edges over all
vertices Both sums must be |E|.
Chapter Exercise
• Chapter # 10
Topic # 10.1
• Q – 1,3,4,5,6,7,8,9,13,16,19,21,22
Topic # 10.2
• Q -1,2,3,4,7,8,9,10,21,22,23,24,27

You might also like