0% found this document useful (0 votes)
88 views22 pages

DS Lecture 22 (Intro To Graphs)

The document introduces graphs and some basic graph terminology. It defines a graph as a set of vertices connected by edges. Graphs are important in several areas of computer science. Key terms discussed include vertices, edges, loops, parallel edges, degree of a vertex, complete graphs, and regular graphs. Examples are provided to illustrate graph concepts like finding incident edges, adjacent vertices, and calculating vertex degrees.

Uploaded by

Malika Dia
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)
88 views22 pages

DS Lecture 22 (Intro To Graphs)

The document introduces graphs and some basic graph terminology. It defines a graph as a set of vertices connected by edges. Graphs are important in several areas of computer science. Key terms discussed include vertices, edges, loops, parallel edges, degree of a vertex, complete graphs, and regular graphs. Examples are provided to illustrate graph concepts like finding incident edges, adjacent vertices, and calculating vertex degrees.

Uploaded by

Malika Dia
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/ 22

DISCRETE STRUCTURES

Lecture # 22
Introduction to graphs

Summiya Alam
INTRODUCTION TO GRAPHS

Graph theory plays an important role in several areas of computer science such as:
• Switching theory and logical design
• Artificial intelligence
• Formal languages
• Computer graphics
• Operating systems
• Compiler writing
• Information organization and retrieval.
GRAPH

A graph is a non-empty set of points called vertices and a set of line segments
joining pairs of vertices called edges.

Formally, a graph G consists of two finite sets:


(i) A set V=V(G) of vertices (or points or nodes)
(ii)A set E=E(G) of edges; where each edge corresponds to a pair of vertices.
GRAPH

The graph G with


• V(G) = {v1, v2, v3, v4, v5} and
• E(G) = {e1, e2, e3, e4, e5, e6}
SOME TERMINOLOGY

• An edge connects either one or two vertices called its endpoints (edge e1
connects vertices v1 and v2 described as {v1, v2} i.e. v1 and v2 are the
endpoints of an edge e1).
• An edge with just one endpoint is called a loop. Thus a loop is an edge that
connects a vertex to itself (e.g., edge e6 makes a loop as it has only one
endpoint v3).
• Two vertices that are connected by an edge are called adjacent; and a vertex
that is an endpoint of a loop is said to be adjacent to itself.
SOME TERMINOLOGY

• An edge is said to be incident on each of its endpoints(i.e. e1 is incident on v1


and v2 ).
• A vertex on which no edges are incident is called isolated (e.g., v5)
• Two distinct edges with the same set of end points are said to be parallel (i.e.
e2 & e3).
EXAMPLE

• Define the following graph formally by specifying its vertex set, its edge set,
and a table giving the edge endpoint function.
EXAMPLE

SOLUTION:
• Vertex Set = {v1, v2, v3, v4}
• Edge Set = {e1, e2, e3}
• Edge - endpoint function is:
EXAMPLE

For the graph shown below


(i) find all edges that are incident on v1;
(ii)find all vertices that are adjacent to v3;
(iii)find all loops;
(iv)find all parallel edges;
(v)find all isolated vertices;
SOLUTION

(i) v1 is incident with edges e1, e2 and e7


(ii) vertices adjacent to v3 are v1 and v2
(iii) loops are e1 and e3
(iv) only edges e4 and e5 are parallel
(v) The only isolated vertex is v4 in this Graph.
DRAWING PICTURE FOR A GRAPH

• Draw picture of Graph H having vertex set {v1, v2, v3, v4, v5} and edge set
{e1, e2, e3, e4} with edge endpoint function
e1
v5
v1 v2

v3 v4
DRAWING PICTURE FOR A GRAPH
SIMPLE GRAPH:
EXERCISE
EXERCISE
DEGREE OF A VERTEX

Let G be a graph and v a vertex of G. The degree of v, denoted deg(v), equals the
number of edges that are incident on v, with an edge that is a loop counted twice.
Note:
(i)The total degree of G is the sum of the degrees of all the vertices of G.
(ii) The degree of a loop is counted twice
DEGREE OF A VERTEX

• EXAMPLE:
COMPLETE GRAPH

• A complete graph on n vertices is a simple graph in which each vertex is


connected to every other vertex and is denoted by Kn (Kn means that there are n
vertices).
• The following are complete graphs K1, K2,K3, K4 and K5.
COMPLETE GRAPH
REGULAR GRAPH

• A graph G is regular of degree k or k-regular if every vertex of G has degree k.


• In other words, a graph is regular if every vertex has the same degree.
REGULAR GRAPH
THANK YOU

You might also like