0% found this document useful (0 votes)
28 views23 pages

Lecture 03

graph theory slide 3

Uploaded by

Hamayon Wazir
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)
28 views23 pages

Lecture 03

graph theory slide 3

Uploaded by

Hamayon Wazir
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/ 23

11/25/2024

Graph Theory
Lecture 3

Dr. Ilyas Fakhir


11/25/2024
Representation of Graphs inside a Machine

• In order to classify the various computer models of graphs,


the three following principles can be distinguished:
 The natural way to represent a non-simple graph is the
Adjacency matrix. This is a square matrix of order n, M =
(mij), where mij is the number of edges having xi & xj
endvertices in G. This implementation of graph takes
memory space of order n2, where n is the number of
vertices. So any algorithm over graphs modeled after
adjacency matrix has O(n2) time complexity.

mij   1 if edge exist between vertex xi and vertex x j


0 otherwise.
11/25/2024
Representation of Graphs inside a Machine (Contd…)
 A second principle for implementing a graph is to give for
each vertex its “neighborhood”. The most classic way to
implement this principle is showing the neighbors as
adjacency list. List of neighbors N(x) for each vertex x.
The memory space need for this type of implementation
is of order n + m, n vertices and m edges. Such model is
coherent with linear processing.
 If in an algorithm the entry to the graph is done by the
edges and not directly by the vertices, as in the above
models, a third implementation principle consists of
giving a list of edges with, for each of them, its
endvertices. Such a list may be linked, which makes it
possible to modify the graph being processed. The
memory space necessary for this type of model is
minimal since it is of the order of the number of edges m
11/25/2024
Representation of Graphs inside a Machine (Contd…)
Weighted Graph

11/25/2024
• Weighted Graphs are often considered, that is graphs with
values, integer or real, positive or not, associated with the
edges.
• Formally, we have a graph G = (X, Y ) with a mapping v : E
→ R.
• When a weighted graph is a simple graph, which is often
the case, its computer model is generally a matrix, such as
the adjacency matrix, but with entries being the values of
the edges under consideration.
• The matrix M = (v(xixj)), where 1 ≤ i, j ≤ n, with mapping v
extended by stating: v(xixj) = ∞ when i ≠ j and xixj ∉ E,
v(xixj) = 0 when i = j. This matrix is symmetric.
Incidence Matrix

11/25/2024
• If the edge set of undirected graph G is E(G) = {al, a2, ... ,
ae},
• then the incidence matrix NG of G is the v x e matrix with

n 
ij 
entries nij, such1 that
if vertex xi is incident with edge a j
0 otherwise.

nij = 2 if vertex xi has self-loop


• The adjacency and incidence matrices depend on the
orderings chosen for V(G) and E(G); they are not unique,
but vary only by row and/or column permutation.
Directed Graph

11/25/2024
• Adjacency Matrix:

1 2 3
4 1

4
Directed Graph

11/25/2024
• Incidence Matrix:
• Degrees: Row-wise sums give vertex degrees, i.e.,
• For digraphs A is not symmetric and row-, colum-wise sums
differ
,
• Spectrum: G is d-regular if and only if 1 is an eigenvector of
A, i.e.,
A1 = d1
Directed Graph

11/25/2024
• A graph can be also represented by its |V | × |E| incidence
matrix B
⇒ B is in general not a square matrix, unless |V | = |E|
• For undirected graphs, the entries of B are

• For digraphs we also encode the direction of the edge,


namely
Directed Graph

11/25/2024
e1 e2 e3 e4 e5
1
2
3
4

• If the graph is weighted, modify nonzero entries


accordingly
11/25/2024
Isomorphism in Graph
• The simple graphs G1 = (V1, E1) and G2 = (V2, E2) are
isomorphic if there is a bijection (a one-to-one and onto
function) f from V1 to V2 with the property that a and b are
adjacent in G1 if and only if f(a) and f(b) are adjacent in G2, for
all a and b in V1.
{a,b}∈E1⇔{f(a),f(b)}∈E2.
• Such a function f is called an isomorphism.
• In other words, G1 and G2 are isomorphic if their vertices can
be ordered in such a way that the adjacency matrices MG1 and
MG2 are identical.

11
11/25/2024
Isomorphism (Contd…)

• In other words, two graphs G1 and G2 are said to be


isomorphic (to each other) if there is a one-to-one
correspondence between their vertices and between their
edges such that the incidence relationship (that is the
adjacency of vertices) is preserved.
• Such graphs will have the same structures differing only in
the way their vertices and edges are labeled or only in the
way they are represented geometrically. For many
purposes, we regard them as essentially the same. When G1
and G2 are isomorphic we write G1 ≡ G2 .
• A graph automorphism is an isomorphism of the graph to
itself.
12
A B P Q

11/25/2024
D C S R
• Observe that both graphs have four vertices and four
edges.
• The one-to-one correspondence between the vertices are:
A↔P; B↔Q; D↔S and C↔R.
• The one-to-one correspondence between the edges are:
(A,B) ↔ (P,R); (A,D)↔(P,S); (B,C)↔(Q,R); (C,D)↔(S,Q).
• These represent one-to-one correspondence between the
edges of the two graphs which preserve the incidence
relationship, i.e., the adjacent vertices and adjacent edges
in the first graph correspond to adjacent vertices and edges 13
11/25/2024
Graph Isomorphism-Example

• EG: Prove that

is isomorphic to

• First label the vertices:


2 2
1 3 1 3
5 4
5 4
14
11/25/2024
Graph Isomorphism-Example
11/25/2024
Example
Show that the multiplicative group G consisting of three
cube roots of unity 1,ω,ω2 is isomorphic to the group G′ of
residue classes under addition of residue classes (mod3).
11/25/2024
11/25/2024
Subgraphs

• Let G and H are two graphs. H is said to be sub


graph of G if the following conditions hold
 All the vertices and edges of H are in G
 Each edge of H has the same end vertices in G as
in H.
• In
other words, if H is a graph with vertex set V(H)
and the edge set E(H) and G is graph with vertex
set V(G) and the edge set E(G) then H is a
subgraph of G whenever V(H) is subset of V(G) and
E(H) is subset of E(G).

18
11/25/2024
Proper subgraph
•A subgraph H is said to be proper subgraph of G if
G has at least one vertex which is not in H.

A A
B B

C C

D D

E
19
11/25/2024
• The following results are immediate consequences of
the definition of Subgraph
 Every graph is a subgraph itself
 Every simple graph of n vertices is a subgraph of the
complete graph Kn
 If K is subgraph of H and H is subgraph of G then K is
subgraph of G
 A single vertex in a graph G is a subgraph of G
 A single edge in a graph G together with its end
vertices is a subgraph of G

20
Edge-disjoint and Vertex-disjoint

11/25/2024
subgraphs
• Let G be graph. Let K and H are two graphs of G. Then
 K and H are said to be edge-disjoint if they do not have
any common edge
 K and H are said to be vertex-disjoint if they do not have
any common edge and any common vertex.
• Notice that the edge-disjoint subgraphs may have
common vertices. Subgraphs that have no vertices in
common cannot possibly have edge in common, i.e., two
vertex-disjoint subgraphs must be edge-disjoint but the
converse is not necessarily true.

21
11/25/2024
• Example of edge-disjoint but not vertex-disjoint
subgraphs

A
C A
B

B D

E` E
E
Subgraph K Subgraph H
D
Graph G

22
11/25/2024
Induced Subgraph
• For any set S of vertices of G, the vertex induced subgraph or simply an
induced subgraph <S> is the maximal subgraph of G with vertex set S.
• Thus, two vertices of S are adjacent in <S> if and only if they are adjacent
in G.

• Here H is not an induced subgraph since v 4v3 ∈ E(G), but v4v3 ∉ E(H). On the
other hand, the graph J is an induced subgraph of G. Thus, every induced
subgraph of a graph G is obtained by deleting a subset of vertices from G.

You might also like