You are on page 1of 35

Discrete Structures

MUHAMMAD JAFFAR KHAN (MS Electrical Engineering)


MASTER IN COMPUTER SCIENCE-1
FEDERAL URDU UNIVERSITY, ISLAMABAD (Campus).
Some Special Simple Graphs
• Special cases of undirected graph structures:
Regular Graph
Complete graphs Kn
Cycles Cn
Wheels Wn
Bipartite graphs

3
4
Complete Graphs Kn

• Note that Knhas edges.

5
Cycles Cn
• A cycle Cn, n ≥ 3, consists of n vertices v1, v2,..., vn
and edges {v1, v2}, {v2, v3}, ..., {vn−1, vn}, and {vn , v1}.

• How many edges are there in Cn?


6
Wheels
• We obtain a wheel Wn when we add an
additional vertex to a cycle Cn, for n ≥ 3, and
connect this new vertex to each of the n vertices
in Cn, by new edges:

7
• After Eid 2A

8
Bipartite Graphs
• A simple graph G=(V,E) is bipartite (or bigraph) iff
where and

English: The graph can be


divided into two parts in such a
way that all edges go between
the two parts.
(No edge in G connects either two
vertices in V1 or two vertices in V2).
9
EXAMPLE 9 at Page# 656
• C6 is bipartite, as shown in Figure, because its
vertex set can be partitioned into the two sets V1 =
{v1, v3, v5} and V2 = {v2, v4, v6}, and every edge of C6
connects a vertex in V1 and a vertex in V2.

10
EXAMPLE 11 at Page# 656
• Is this Bipartite graph?

• Yes!
V={a, b, c, d, e, f, g}
V1 ={a, b, d}
V2 ={c, e, f, g}

11
EXAMPLE 11 at Page# 656
• Is this Bipartite graph?

• No!
V={a, b, c, d, e, f}
V1 ={a, f, e, d}
V2 ={b, e, f, g}

12
• See Ex. 5, 6, 7, 9, 10, 12. p-655
• Exercise Q. 4, 5, 7, 9, 21-25, 29 p-665
How about these?

14
Complete Bipartite Graphs
• A complete bipartite graph Km,n is a graph that
has its vertex set partitioned into two subsets of
m and n vertices, respectively with an edge
between two vertices iff one vertex is in the first
subset and the other vertex is in the second
subset.

15
Some Applications
• Star, Ring, and Hybrid Topologies for Local Area
Networks

complete bipartite graph K1,n n-cycles wheels Wn

16
New Graphs from Old

17
EXAMPLE 18 at Page# 663
Subgraphs
• A subgraph of a graph G = (V ,E) is a graph H =
(W, F), where W ⊆ V and F ⊆ E.
• A subgraphH of G is a proper subgraphof G if .

• Can F be any subset of E?

18
Another Example

19
EXAMPLE 19 at Page# 664

20
Spanning Subgraphs

• A subgraph S of a graph G is
a graph such that
– The edges of S are a
subset of the edges of G Subgraph

• A spanning subgraph of G is
a subgraph that contains all
the vertices of G
Spanning subgraph
21
10.3 Representing Graphs

22
Adjacency List

Adjacency list representation:


a adjacent to b,c
b adjacent to a,c
c adjacent to a,b

23
Adjacency List Cont.
• A table with 1 row per vertex, listing its
connected vertices.
• How many entries?

• What if it is directed?
24
EXAMPLE 1 at Page# 668
Adjacency List Cont.
• Use adjacency lists to describe the simple graph
given in Figure.

25
EXAMPLE 2 at Page# 669
Adjacency List Cont.
• Represent the directed graph shown in Figure by listing all the
vertices that are the terminal vertices of edges starting at each
vertex of the graph.

26
Adjacency Matrix
• For Simple Graph G
• Matrix A=[aij], where aij is:
 1 if {vi, vj} is an edge of G
 0 otherwise

27
Example 3 at Page# 669
Use an adjacency matrix to represent the graph shown in Figure.

a b c d
a 0 1 1 1
b 1 0 1 0
c 1 1 0 0
d 1 0 0 0
28
Example 4 at Page# 669
• Draw a graph with the adjacency matrix.

with respect to the ordering of


vertices a, b, c, d.
Solution:
a b c d
a 0 1 1 1
b 1 0 1 0
c 1 1 0 0
d 1 0 0 0
29
Example 5 at Page# 670
Pseudograph: Loops & multiple edges
Use an adjacency matrix to represent the pseudograph
shown in Figure a b c d
a 0 3 0 2
b 3 0 1 1
c 0 1 1 2
d 2 1 2 0

What if it is directed?
30
Directed Graphs

a b c d e
a 0 1 1 1 1
b 0 1 0 1 0
c 1 0 1 0 1
d 0 0 0 0 0
e 0 1 1 1 0

31
Incidence Matrices
• Let G = (V ,E) be an undirected graph.
Suppose that v1, v2, . . . , vn are the vertices and e1,
e2, . . . , em are the edges of G.
• Then the incidence matrix with respect to this
ordering of V and E is the n × m matrix
M = [mij ], where

32
Example 6 at Page# 671
Incidence Matrix
• Represent the graph shown in Figure with an
incidence matrix.

• A table with 1 row per vertex, listing its adjacent


vertices
33
Example 7 at Page# 671
• Represent the pseudograph shown in Figure 7
using an incidence matrix.

34
Do
• Ex. 1, 2, 3, 4, 5, 6, 7. p-668
• Questions 1, 3, 5, 7, 11, 17, 19, 23, 27. p-675

END
35

You might also like