100% found this document useful (1 vote)
17 views45 pages

Graph Theory L-1-3

Uploaded by

gaxet91470
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
17 views45 pages

Graph Theory L-1-3

Uploaded by

gaxet91470
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Graph Theory

Königsberg Bridge Problem


Topic
Graph Isomorphism Degree
Definition Elaborate on what Degree of a Graph
you want to discuss.

Sub Graph Matrix Degree


Definition Representation Sequences
Another way of Important representation.
representing a graph
Graph
A generalization of the simple concept of a set of dots, links, edges or
arcs.

DEF: A simple graph G = (V,E ) consists of a non-empty set V of


vertices (or nodes) and a set E (possibly empty) of edges where
each edge is a subset of V with cardinality 2 (an unordered pair).

Q: For a set V with n elements, how many possible edges there?


Simple Graphs

A: The number of pairs in V


= C (n,2) = n · (n -1) / 2

Q: How many possible graphs are there for the same set of vertices V ?

7
Simple Graphs
A: The number of subsets in the set of possible edges.

There are n · (n -1) / 2 possible edges,

therefore the number of graphs on V is 2n(n -1)/2

8
Definitions – Edge Type
Directed: Ordered pair of vertices. Represented as (u, v) directed from
vertex u to v.
u v

Undirected: Unordered pair of vertices. Represented as {u, v}. Disregards


any sense of direction and treats both end vertices interchangeably.

u v
Definitions – Edge Type
• Loop: A loop is an edge whose endpoints are equal i.e., an edge joining
a vertex to itself is called a loop. Represented as {u, u} = {u}

• Multiple Edges: Two or more edges joining the same pair of vertices.
Definitions – Graph Type

Simple (Undirected) Graph: consists of V, a nonempty set of vertices,


and E, a set of unordered pairs of distinct elements of V called edges
(undirected)
Representation Example: G(V, E), V = {u, v, w}, E = {{u, v}, {v, w}, {u, w}}

u v

w
Definitions – Graph Type

Multigraph: G(V,E), consists of set of vertices V, set of Edges E and a


function f from E to {{u, v}| u, v V, u ≠ v}. The edges e1 and e2 are
called multiple or parallel edges if f (e1) = f (e2).

Representation Example: V = {u, v, w}, E = {e1, e2, e3}

u
e1 e2
w

e3
v
Definitions – Graph Type

Pseudograph: G(V,E), consists of set of vertices V, set of Edges E and


a function F from E to {{u, v}| u, v Î V}. Loops allowed in such a graph.

Representation Example: V = {u, v, w}, E = {e1, e2, e3, e4}

uu
ee11 w
w ee44
ee22

vv ee33
Definitions – Graph Type

Directed Graph: G(V, E), set of vertices V, and set of Edges E, that are ordered pairs of
elements of V (directed edges)

Representation Example: G(V, E), V = {u, v, w}, E = {(u, v), (v, w), (w, u)}

u v

w
Definitions – Graph Type

Directed Multigraph: G(V,E), consists of set of vertices V, set of Edges E


and a function f from E to {{u, v}| u, v V}. The edges e1 and e2 are multiple
edges if f(e1) = f(e2)

Representation Example: V = {u, v, w}, E = {e1, e2, e3, e4}

u
w e4
e1 e2

v e3
Definitions – Graph Type

Type Edges Multiple Edges Loops Allowed ?


Allowed ?
Simple Graph undirected No No

Multigraph undirected Yes No

Pseudograph undirected Yes Yes

Directed Graph directed No Yes

Directed directed Yes Yes


Multigraph
Order of a graph: The order of a graph G is the cardinality of its vertex set

Size of a graph: the size of a graph is the cardinality of its edge set
Terminology – Undirected graphs
• u and v are adjacent if {u, v} is an edge, e is called incident with u and v. u and v
are called endpoints of {u, v}

• Degree of Vertex (deg (v)): the number of edges incident on a vertex. A loop
contributes twice to the degree (why?).

• Pendant Vertex: deg (v) =1

• Isolated Vertex: deg (k) = 0

Representation Example: For V = {u, v, w} , E = { {u, w}, {u, v} }, deg (u) = 2, deg (v) =
1, deg (w) = 1, deg (k) = 0, w and v are pendant , k is isolated
u v
k

w
Terminology – Directed graphs
• For the edge (u, v), u is adjacent to v OR v is adjacent from u, u – Initial vertex, v – Terminal vertex

• In-degree (deg- (u)): number of edges for which u is terminal vertex

• Out-degree (deg+ (u)): number of edges for which u is initial vertex

Note: A loop contributes 1 to both in-degree and out-degree (why?)

Representation Example: For V = {u, v, w} , E = { (u, w), ( v, w), (u, v) }, deg- (u) = 0, deg+ (u) = 2, deg- (v) = 1,
deg+ (v) = 1, and deg- (w) = 2, deg+ (u) = 0

u v

w
Theorems: Undirected Graphs

Theorem 1
The Handshaking theorem:
2e =  deg( v)
vV

(why?) Every edge connects 2 vertices


Theorems: Undirected Graphs

Theorem 2:
An undirected graph has even number of vertices with odd degree

Pr oof V 1 is the set of even degree vertices and V2 refers to odd degree vertices
2e =  deg(v) =  deg(u) +  deg(v)
vV u  V1 v  V2

 deg (v) is even for v  V1,


 The first term in the right hand side of the last inequality is even.
 The sum of the last two terms on the right hand side of
the last inequality is even since sum is 2e.
Hence second term is also even
 second term  deg(u) = even
v  V2
Theorems: directed Graphs

• Theorem 3: deg + (u) = deg - (u) = |E|


Degree
Sequence
• Degree sequence of a graph is the
list of degree of all the vertices of
the graph. Usually, we list the
degrees in nonincreasing order,
that is from largest degree to
smallest degree.
Subgraphs

• A subgraph of a graph G = (V, E) is a graph H =(V’, E’) where V’ is a subset of V


and E’ is a subset of E
Application example: solving sub-problems within a graph
Representation example: V = {u, v, w}, E = ({u, v}, {v, w}, {w, u}}, H1 , H2

u u u

v w v w v

G H1 H2
Subgraphs

Notice that the 2-cube occurs

inside the 3-cube .

In other words, Q2 is a subgraph


25 of Q3 :

DEF: Let G = (V,E ) and H = (W,F ) be graphs. H is said to be a


subgraph of G, if W  V and F  E.
Q: How many Q2 subgraphs does Q3 have?
Subgraphs

A: Each face of Q3 is a Q2 subgraph so the answer is 6, as this is


the number of faces on a 3-cube:

26
Subgraphs

• G = G1 U G2 wherein E = E1 U E2 and V = V1 U V2, G, G1 and G2 are simple


graphs of G

Representation example: V1 = {u, w}, E1 = {{u, w}}, V2 = {w, v},


E2 = {{w, v}}, V = {u, v ,w}, E = {{{u, w}, {{w, v}}

u
u

w v
w w v

G1 G2 G
Unions

In previous example can actually reconstruct the 3-cube from


its 6 2-cube faces:

28
Unions
If we assign the 2-cube faces (aka Squares) the names S1, S2, S3,
S4, S5, S6 then Q3 is the union of its faces:
Q3 = S1S2S3S4S5S6

29
Unions

DEF: Let G1 = (V1, E1 ) and G2 = (V2, E2 ) be two simple graphs (and


V1,V2 may or may not be disjoint). The union of G1, G2 is
formed by taking the union of the vertices and edges. I.E:
G1G2 = (V1V2, E1E2 ).
A similar definitions can be created for unions of digraphs,
multigraphs, pseudographs, etc.

30
Spanning Subgraph

• A spanning subgraph of a graph G is a


subgraph obtained by edge deletions only
(so that a spanning subgraph is a subgraph
of G with the same vertex set as G). With S
a set of deleted edges, the spanning
subgraph is denoted G \ S.
Induced Subgraph

• A subgraph obtained from graph G by


vertex deletion only is an induced subgraph
of G. If X is the set of deleted vertices, the
induced subgraph is denoted G − X. With Y
= V (G) \ X, the induced subgraph is
denoted G[Y ] and called the subgraph of G
induced by vertex set Y.
Clique

• A clique is a subset of vertices of an undirected


graph G such that every two distinct vertices in
the clique are adjacent; that is, its induced
subgraph is complete.
• A maximal clique is a clique that cannot be
extended by including one more adjacent
vertex, that is, a clique which does not exist
exclusively within the vertex set of a larger
clique.
Representation

• Incidence (Matrix): Most useful when information about edges is more


desirable than information about vertices.

• Adjacency (Matrix/List): Most useful when information about the


vertices is more desirable than information about the edges. These two
representations are also most popular since information about the
vertices is often more desirable than edges in most applications
Representation- Incidence Matrix

• G = (V, E) be an unditected graph. Suppose that v1, v2, v3, …, 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 nx m matrix M = [m ij], where Can also be used to
represent :
Multiple edges: by using columns with identical entries, since these edges are
incident with the same pair of vertices
Loops: by using a column with exactly one entry equal to 1, corresponding to the
vertex that is incident with the loop

1 when edge ej is incident w ith v i


m ij = 
0 otherwise
Representation- Incidence Matrix

• Representation Example: G = (V, E)

e1 e2 e3
u
v 1 0 1
e1 e2
u 1 1 0

v w w 0 1 1
e3
Representation- Adjacency Matrix

• There is an N x N matrix, where |V| = N , the Adjacent Matrix (NxN) A = [aij]

For undirected graph

1 if {vi, vj} is an edge of G


a ij = 
0 otherwise

• For directed graph

1 if (vi, vj) is an edge of G


a ij = 
0 otherwise

• This makes it easier to find subgraphs, and to reverse graphs if needed.


Representation- Adjacency
Matrix

• Adjacency is chosen on the ordering of vertices. Hence, there as are as


many as n! such matrices.
• The adjacency matrix of simple graphs are symmetric (aij = aji) (why?)
• When there are relatively few edges in the graph the adjacency matrix
is a sparse matrix
• Directed Multigraphs can be represented by using aij = number of
edges from vi to vj
Representation- Adjacency Matrix

• Example: Undirected Graph G (V, E)

v u w
u
v 0 1 1

u 1 0 1
v w
w 1 1 0
Representation- Adjacency Matrix

• Example: directed Graph G (V, E)

v u w
u
v 0 1 0

u 0 0 1
v w
w 1 0 0
Representation- Adjacency List

Each node (vertex) has a list of which nodes (vertex) it is adjacent

Example: undirectd graph G (V, E)

u
node Adjacency List

u v,w

v w, u
v w
w u,v
Graph - Isomorphism

• G1 = (V1, E2) and G2 = (V2, E2) are isomorphic if:


• There is 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.
• Function f is called isomorphism

Application Example:
In chemistry, to find if two compounds have the same structure
Graph - Isomorphism

Representation example: G1 = (V1, E1) , G2 = (V2, E2)


f(u1) = v1, f(u2) = v4, f(u3) = v3, f(u4) = v2,

u1 u2 v1 v2

u3 u4 v4
v3
Thank you!
Write a closing statement or call-to-action here.

You might also like