What is a Graph_
What is a Graph_
Graph Structure
Edges
Connections between
Graph vertices
Definition of Graph
A graph G can be defined as an ordered pair (V,E) where:
• V is a set of vertices.
• E is a set of edges, where each edge is a pair of vertices from V.
V is a set of
vertices
Define Graph
Start
G Each edge is
E is a set of a pair of
edges vertices from
V
Variable Relationships
Financial Context
Data Representation
Visual Simplification
Vertex Edge
Represents a point Connects two
in space points with a line
Types of Graphs
There are various types of graphs in graph theory, some of these are:
Types of Graphs in Graph Theory
Weighted Graphs
Simple Graph
A graph where
A graph with no
edges have
loops or multiple
numerical values
edges
• Null Graph
• Trivial Graph
• Simple Graph
• Undirected Graph
• Directed Graph
• Weighted Graphs
• Complete Graph
• Bipartite Graphs
Hierarchy of Graph Types
Directed Graph
Edges have a direction
Complete Graph
Every vertex is connected to
Bipartite Graphs every other vertex
In other words, a null graph has vertices but no edges connecting any pairs of vertices.
Consider a null graph with three vertices:
Vertex Set V:
Vertices
{A, B, C]
Null Graph
Edge Set E: {]
No Edges
or φ
Trivial Graph
A trivial graph is the simplest type of graph, consisting of exactly one vertex and no
edges.
Trivial Graph Structure
Single
No Edges
Vertex
Edges
Connections between
Simple Graph vertices
This means that a simple graph does not contain any loops (edges that connect a vertex to
itself) or multiple edges between the same pair of vertices.
Consider a simple graph with four vertices:
• Vertex set V: {A, B, C, D}
• Edge set E: { {A, B}, {A, C}, {B, D}, {C, D} }
Undirected Graph
An undirected graph is a type of graph in which the edges have no direction.
Types of Graphs
Cycle Graph
Nodes form a closed
loop
This means that the relationship between any pair of connected vertices is mutual. In an
undirected graph, the edge (u, v) is identical to the edge (v, u).
Consider an undirected graph with four vertices:
• Vertex set V: {A, B, C, D}
• Edge set E: { {A, B}, {A, C}, {B, D}, {C, D} }
Directed Graph
A directed graph, also known as a digraph, is a type of graph where the edges have a
direction.
In other words, each edge has a starting vertex (source) and an ending vertex (destination),
indicating a one-way relationship between the vertices.
Consider a directed graph with four vertices:
• Vertex set V: {A, B, C, D}
• Edge set E: { (A, B), (A, C), (B, D), (C, D)}
Weighted Graphs
A weighted graph is a type of graph in which each edge is assigned a weight (or cost).
These weights can represent various quantities such as distances, costs, capacities, or any
other metric that quantifies the relationship between vertices.
Consider a weighted graph with four vertices
• Vertex set V: {A, B, C, D}
• Edge set E: { (A, B, 3), (A, C, 5), (B, D, 2), (C, D, 1) }
Complete Graph
If every vertex in a graph G is linked to every other vertex in the graph, then the graph is said
to be complete. Therefore, every graph G has to be linked. Kn represents the whole graph
with n vertices.
Consider a complete graph with four vertices:
• Vertex set V: {A, B, C, D}
• Edge set E: { {A, B}, {A, C}, {A, D}, {B, C}, {B, D}, {C, D} }
Note: Number of Edges in complete graphs with n vertices is n(n - 1)/2.
Bipartite Graphs
A bipartite graph is a type of graph where the vertex set can be divided into two
disjoint sets such that no two vertices within the same set are adjacent.
This means that every edge in a bipartite graph connects a vertex in one set to a vertex in the
other set.
Consider a bipartite graph with vertex sets:
• Vertex sets V1: {A, B}, V2: {C, D}
• Edge set E: { {A, C}, {A, D}, {B, C} }
Cycle Graph
A cycle graph, also known as a circular graph, is a type of graph that forms a single
cycle.
In a cycle graph, each vertex has exactly two neighbors, creating a closed loop.
Consider a cycle graph C4 with four vertices:
• Vertex set V: {A, B, C, D}
• Edge set E: {{A, B}, {B, C}, {C, D}, {D, A} }