Graph Theory
Graph Theory
Graph Theory
Graph Terminology,
Special Types of
Graphs and
Representation of
Graphs.
Graph
•A graph G(V,E) is a collection of vertices (or nodes) and a
collection of edges that connect pairs of vertices.
•A graph may be undirected, meaning that there is no
distinction between the two vertices associated with each
edge, or its edges may be directed from one vertex to another.
Terminologies
•Vertex (plural:vertices) : A node in a graph.
•Arc: The edge in a directed graph.
•Cycle:
A path consisting of at least three vertices that
starts and ends with the same vertex.
Must follow the proper direction in a digraph.
•Loop:
A special case of a cycle in which a single arc begins and
ends with the same vertex.
•Degree:
The degree of a vertex is the number of edges incident to it
The outdegree of a vertex in a digraph is the number of
arcs leaving the vertex
The indegree of a vertex in a digraph is the number of arcs
entering the vertex
Name of the Faculty: Shelly Khurana Program Name: B.Tech
School of Computing Science and Engineering
Course Code : MATH2007 Course Name: Discrete Mathematics
Multigraph
Any graph which contains some multiple edges is called
a multigraph. In a multigraph. No loops are allowed.
•Edges with own identity: Edges are basic units just like nodes.
When multiple edges connect two nodes, these are different edges.
BIPARTITE GRAPH
A bipartite graph, also called a bigraph, is a set of graph vertices decomposed into two separate
sets such that no two graph vertices within the same set are adjacent.
REPRESENTATION OF GRAPHS
Adjacency Matrix
•You can represent a directed or undirected graph in
the form of a matrix or two-dimensional array.
If you compare the adjacency matrix with the directed graph shown above, you will find that all
the directed edges viz, PQ, PT, RP, RS, TR, TS have a value of 1 whereas the other edges have a
value of 0.
The adjacency matrix of a directed graph can also be represented in the form of an array of size
V*V with rows represented by the letter i and columns represented by the letter j. An entry in
row i or column j will be equal to either 1 or 0. It will be equal to 1 if there is a directed edge
between i and j, else it is 0. Let's see how to represent the directed graph shown above, as an
array.
Adjacency list
Another way to represent a graph without multiple edges is to list all the edges of this graph. Another
way to represent a graph with no multiple edges is to use adjacency lists, which specify the
vertices that are adjacent to each vertex of the graph.