LectureNote_MA221_24Oct
LectureNote_MA221_24Oct
• Represented as 𝐺 = 𝑉, 𝐸 c
d
• V: non-empty set of vertices/nodes
• E: set of edges 𝑉𝑖 , 𝑉𝑗 -- could be
empty 𝑉𝑖 , 𝑉𝑗 𝐸 and 𝑉𝑖 , 𝑉𝑗 V
Graph
a
b
• Directed graph c
d
• Edges are ordered pairs
• Undirected graph
• Edges are unordered pairs a
b
• Simple graph (directed/undirected)
• No self-loops c
d
• At most one edge between any two nodes
a
b
c
d
Undirected Graph: Terminologies
• Let 𝐺 = 𝑉, 𝐸 be an undirected graph
• Vertices u,v are called adjacent/neighbours if (u,v)E
• An edge e E is said to be incident with nodes u, v if e = (u,v)
• Degree of vertex v V
• Number of edges incident with v
• Self-loop (if any) contributing two to the degree of v
a
b
c
d
Undirected Graph: Handshaking Theorem
• Let 𝐺 = 𝑉, 𝐸 be an undirected graph, where |E| = m
σ𝑣𝜖𝑉 deg 𝑣 = 2𝑚
• Consider an edge e = 𝑢, 𝑣 𝜖 𝐸
• What will be the contribution of e to σ𝑣𝜖𝑉 deg 𝑣 ?
• 2: One to deg 𝑢 and deg 𝑣
Undirected Graph: Euler’s Theorem
• Let 𝐺 = 𝑉, 𝐸 be an undirected graph, where |E| = m
Theorem: σ𝑣𝜖𝑉 deg 𝑣 = 2𝑚
Even Even
Problems
• Suppose we have a simple graph G with n vertices
• What is the maximum number of edges G can contain, if
(i) G is an undirected graph ?
(ii) G is a directed graph ?
Problems
• What are the degrees and neighbors of each vertex in the following
graph
Directed Graph: Terminologies
• Let e be an edge that connects vertices from u to v
• We say
(i) u = initial vertex, v = terminal vertex ;
(ii) u is adjacent to v;
(iii) v is adjacent from u;
(iv) if u = v, the edge e is called a loop
• The in-degree of a vertex v, denoted by deg–(v), is the number of
edges with v as terminal vertex
• The out-degree of a vertex u, denoted by deg+(u), is the number of
edges with u as initial vertex
Problems
• What are the in- and out-degrees of each vertex in the following
graph ?
Directed Graph: Handshaking Theorem
• Let G = (V, E) be directed graph with m edges
𝐾𝑚,𝑛 : if |𝑉1 |= m
and |𝑉2 |= n
Check if a Graph is Bipartite
• The following is a very useful theorem :
• Theorem: A simple graph is bipartite if and only if it is possible to
assign one of two different colors to each vertex, so that no two
adjacent vertices are assigned the same color
• Proof :
• If there is a way to color the vertices, the same way shows a possible partition
of vertices.
• Conversely, if there is a way to partition the vertices, the same way gives a
possible coloring.