Graph Theory Blog
Graph Theory Blog
INTRODUCTION :
Graph theory is a branch of mathematics concerned with the study of graphs and networks, which
consist of vertices (also called nodes) and edges connecting them. It deals with various topics such as
graph representation, connectivity, traversal algorithms, graph coloring, network flows, and more.
Graph theory has applications in various fields including computer science, operations research, social
network analysis, and many others
Graph theory is a branch of mathematics concerned with the study of graphs and networks, which
consist of vertices (also called nodes) and edges connecting them. It deals with various topics such as
graph representation, connectivity, traversal algorithms, graph coloring, network flows, and more.
Graph theory has applications in various fields including computer science, operations research, social
network analysis, and many others.
BASIC TERMS:
Strongly Connected Components (SCCs): a subgraph where there exists a directed path between every
pair of vertices
Adjacency Matrix: a square matrix that represents a graph with rows and columns corresponding to
vertices, and entries indicating the presence of an edge between vertices.
Adjacency List: a representation of a graph as a list of vertices and their adjacent vertices.
TYPES OF GRAPHS:
Undirected graph: A graph where edges don’t have a direction and can be traveled in both directions.
Directed graph (also called digraph): A graph where edges have a direction and can only be traveled in
one direction.
Weighted graph: A graph where each edge has a value (weight) associated with it.
Complete graph: A graph where there is an edge between every pair of vertices.
Cyclic graph: A graph that contains at least one cycle, a path that starts and ends at the same vertex.
Bipartite graph: A graph that can be separated into two sets of vertices such that there are no edges
between vertices in the same set.
Regular graph: A graph where each vertex has the same number of edges.
Simple graph: A graph without self-loops (edges connecting a vertex to itself) or multiple edges (multiple
edges connecting the same pair of vertices).
APPLICATIONS:
Computer Science: Network topology, graph algorithms (such as shortest path, minimum spanning tree),
and graph databases.
Operations Research: Project scheduling, transportation networks, and graph optimization problems.
Social Network Analysis: Studying relationships and connections between individuals in social networks.
Transportation: Designing and analyzing transportation networks, such as road, air, and rail networks.
Linguistics: Studying relationships between words and their meanings in natural language processing.
Economics: Studying market structures and relationships between companies in industrial organization.
Physics: Modeling physical systems and representing energy landscapes in materials science.
These are just a few examples, graph theory has applications in many other areas as well.
UNDIRECTED GRAPH:
DIRECTED GRAPH:
A directed graph is a type of graph structure where the edges have a direction and represent a one-way
relationship between the vertices they connect. In a directed graph, each vertex is connected to other
vertices through directed edges, which have a specific starting vertex (the “tail”) and ending vertex (the
“head”). The direction of the edge from tail to head represents the relationship between the two
vertices. Directed graphs are commonly used in various fields, such as computer science, mathematics,
and social network analysis, to model and analyze complex relationships between entities.
These concepts and formulas provide the foundation for algorithms and computations on directed
graphs, such as finding shortest paths, detecting cycles, and computing graph centralities.
SIMPLE GRAPH :
A simple graph is a type of graph that does not contain any loops (edges that start and end at the same
vertex) or multiple edges (two or more edges that connect the same pair of vertices). A simple graph
only consists of a set of vertices and a set of edges that connect these vertices in a one-to-one
relationship. The vertices in a simple graph can be represented as dots and the edges as lines connecting
the dots. Simple graphs are used in many fields, such as mathematics, computer science, and physics, to
represent and analyze relationships between objects or entities.
REGULAR GRAPH :
A regular graph is a type of graph where each vertex has the same number of edges (or degree)
connecting to other vertices. In a regular graph, every vertex has exactly “k” edges connecting it to other
vertices, where “k” is called the degree of the graph. A regular graph with degree “k” is referred to as a
k-regular graph. For example, a 3-regular graph is a graph where each vertex has exactly three edges
connecting it to other vertices. Regular graphs have many applications in fields such as computer
science, mathematics, and physics, where they are used to model and analyze relationships between
objects or entities.
Degree: In a regular graph, every vertex has the same number of edges, known as the degree of the
graph.
Handshaking Theorem: The sum of the degrees of all vertices in a regular graph is equal to twice the
number of edges in the graph.
Symmetry: Regular graphs have a high degree of symmetry, as every vertex is identical to every other
vertex in terms of the number of edges connecting it to other vertices.
Regular Bipartite Graphs: A regular graph is bipartite if and only if its degree is even.
Connectivity: Regular graphs with a high degree are generally highly connected and have many paths
between vertices.
Regular Polygons: Regular graphs can be used to model regular polyggon shapes, such as triangles,
squares, and hexagons, by connecting vertices with edges.
These properties make regular graphs a useful tool for modeling and analyzing relationships between
objects or entities in various fields, such as computer science, mathematics, and physics.
COMPLETE GRAPH:
A complete graph is a type of graph where there is an edge between every pair of vertices. In a complete
graph, every vertex is connected to every other vertex, meaning that there are no isolated vertices and
the graph is fully connected. The number of edges in a complete graph with “n” vertices is given by the
formula (n * (n-1)) / 2. Complete graphs are often used in mathematics and computer science to model
fully connected networks or complete interactions between objects or entities. They are also used as
building blocks for other types of graphs, such as bipartite graphs and regular graphs.
Properties:
Number of vertices: In a complete graph with “n” vertices, there are n nodes in the graph.
Number of edges: The number of edges in a complete graph with “n” vertices is given by the formula (n
* (n-1)) / 2.
Degree of a vertex: In a complete graph, every vertex has degree “n-1”, meaning it is connected to every
other vertex in the graph.
Handshaking Theorem: The sum of the degrees of all vertices in a complete graph is equal to twice the
number of edges in the graph.
Cliques: A complete graph is also known as a clique, as every vertex is connected to every other vertex
and there are no isolated vertices.
Diameter: The diameter of a complete graph is always equal to 1, as there is a direct edge between
every pair of vertices.
Symmetry: Complete graphs have a high degree of symmetry, as every vertex is identical to every other
vertex in terms of the number of edges connecting it to other vertices.
These properties and formulas provide a foundation for analyzing and manipulating complete graphs in
various fields, such as mathematics, computer science, and physics.
NULL GRAPH:
A null graph is a type of graph that contains no edges or vertices. In other words, it is an empty graph
with no connections between vertices. Null graphs are used as a base case in graph theory and
algorithms, as they represent a lack of connectivity or relationships between objects or entities. They are
also used to represent graphs with no vertices or no edges, such as an empty set, and are sometimes
referred to as the trivial graph or the empty graph. In mathematical and computer science applications,
null graphs serve as a starting point for creating and analyzing more complex graphs.
ISOLATED GRAPH:
An isolated graph is a type of graph that contains only isolated vertices, with no edges connecting them.
In other words, it is a graph where each vertex has degree 0 and is not connected to any other vertices
in the graph. Isolated graphs can be seen as a generalization of null graphs, which contain no vertices or
edges, to graphs that contain only vertices and no edges. Isolated graphs are often used in graph theory
to represent a lack of connections or relationships between objects or entities, or to describe graphs
with very few edges or connections. They are also used in algorithms and data structures to represent
disconnected components or disconnected subgraphs within a larger graph.
SUB GRAPH:
A subgraph is a portion of a graph that includes some of the vertices and edges of the original graph. It
can be obtained by selecting a set of vertices and all edges connecting them in the original graph. A
subgraph retains the connections and relationships among the selected vertices and edges, and can also
have its own properties and characteristics that differ from those of the original graph.
PROPERTIES OF SUBGRAPH
Vertex subset: A subgraph consists of a subset of vertices from the original graph.
Edge subset: The edges of a subgraph are a subset of edges from the original graph.
Inherited structure: A subgraph retains the connections and relationships among the vertices and edges
from the original graph.
Independent properties: A subgraph can also have its own properties and characteristics that differ from
those of the original graph, such as degree, connectedness, and cycles.
Subgraph Isomorphism: Two subgraphs are considered isomorphic if they have the same structure,
regardless of the labeling of their vertices and edges.
Induced subgraph: An induced subgraph is a subgraph created by selecting a set of vertices and all edges
connecting them in the original graph.
The number of possible subgraphs of a graph depends on the number of vertices and edges in the graph.
For a graph with n vertices, there are 2^n possible subsets of vertices, each of which can be a subgraph.
This means that the total number of possible subgraphs is the sum of all possible subsets of vertices, or
2^n.
However, not all of these subgraphs will necessarily be unique or distinct, as some may contain the
same set of vertices and edges. The number of distinct subgraphs will depend on the specific structure
and properties of the original graph.
GRAPH TRAVERSALS:
Graph traversals refer to the process of visiting all the nodes in a graph data structure, visiting some or
all of their neighbors and tracking the nodes that have already been visited. The two most common
types of graph traversals are:
1.BFS
Breadth-first search (BFS) is a graph traversal algorithm that visits all the vertices at the current depth
level before moving on to the vertices at the next level of depth. BFS starts at a source vertex and
explores all the neighbors at the current depth level before moving one level deeper. The algorithm
continues until all vertices have been visited or a target vertex is found. BFS can be implemented using a
queue data structure to keep track of the vertices to be visited next. BFS is useful for finding the shortest
path between two vertices, computing the connected components of a graph, and solving problems that
require a level-by-level search of a graph.
ALGORITHM:
BFS(G, s):
Create a queue Q
Mark s as visited
Enqueue s onto Q
Mark v as visited
If w is not visited:
Mark w as visited
Enqueue w onto Q
DFS:
Depth-first search (DFS) is a graph traversal algorithm that visits a vertex and then recursively visits all its
unvisited neighbors before backtracking. The algorithm starts at a source vertex and explores as far as
possible along each branch before backtracking. DFS can be implemented using a stack data structure to
keep track of the vertices to be visited next. DFS is useful for solving problems that require a deep
search of a graph, such as finding a path between two vertices or determining if a graph is cyclic.
PROCEDURE :
If a neighbor is not visited, mark it as visited and push it onto the stack.
The algorithm continues until all vertices have been visited or a target vertex is found. The visited
vertices can be stored in a separate data structure, such as an array or hash table, for later use.
DFS(G, v):
Create a stack S
Mark v as visited
Push v onto S
If w is not visited:
Mark w as visited
Push w onto S
GRAPH REPRESENTATION
A graph can be represented as an adjacency matrix, which is a square matrix with rows and columns
representing vertices in the graph, and the entries in the matrix indicating the presence or absence of
edges between the vertices. If there is an edge between vertices I and j, the entry at the i-th row and j-th
column (or j-th row and i-th column) is set to 1, otherwise it is set to 0.
For a weighted graph, the entries in the adjacency matrix can be set to the weights of the edges instead
of binary values. The entry at the i-th row and j-th column (or j-th row and i-th column) is set to the
weight of the edge connecting vertices I and j if it exists, and to infinity if no edge exists.
The adjacency matrix representation of a graph is useful for dense graphs, where the number of edges is
close to the maximum possible number of edges, as it provides a simple way to represent and
manipulate the graph. However, for sparse graphs, where the number of edges is much smaller than the
maximum possible number, it is more efficient to use other graph representations such as adjacency list
Adjacency Matrix: A square matrix where the rows and columns represent vertices in the graph, and the
entries indicate the presence or absence of edges between the vertices.
Adjacency List: A list of vertices and their neighbors, represented as linked lists or arrays.
Incidence Matrix: A matrix where the rows represent vertices and the columns represent edges, and the
entries indicate whether a vertex is incident to an edge or not.
Object-Oriented: A graph can also be represented as a set of objects, where vertices are represented as
objects and edges as relationships between the objects.
Each representation has its own advantages and disadvantages, and the choice of representation
depends on the specific requirements of the problem, such as the number of vertices and edges, the
type of graph operations required, and the memory and time constraints.
BIPARTIE GRAPHS:
A bipartite graph is a graph whose vertices can be split into two disjoint sets such that every edge
connects a vertex in one set with a vertex in the other set. These sets are commonly referred to as the
“left” and “right” sets, or the “top” and “bottom” sets. Bipartite graphs are used in many real-world
applications, including network flow analysis, data representation and recommendation systems.
The number of possible bipartite graphs with n nodes is not fixed and can vary greatly depending on the
number of edges in the graph and the specific arrangement of those edges. In general, there is no
closed-form formula for counting the number of bipartite graphs with n nodes, and the problem of
counting such graphs is NP-hard. However, researchers have studied various approximate or asymptotic
methods for estimating the number of bipartite graphs with n nodes.
PROPERTIES:
No odd-length cycles: In a bipartite graph, there are no cycles of odd length. This is because all cycles in
a bipartite graph must alternate between vertices in the two sets.
Maximum matching: A bipartite graph has a maximum matching, which is a set of edges with no
common vertices such that no other edges can be added without creating a cycle. The maximum
matching can be found using algorithms such as the Ford-Fulkerson or Hopcroft-Karp algorithms.
Vertex cover: The minimum number of vertices needed to cover all edges in a bipartite graph is equal to
the size of a maximum matching in the graph. This result is known as konigs theorem.
Hall’s theorem: A necessary and sufficient condition for a bipartite graph to have a perfect matching (a
matching that covers all vertices in the graph) is that every subset of vertices on one side of the
bipartition must have at least as many neighbors on the other side as the number of vertices in the
subset.
These properties make bipartite graphs useful for modeling and solving problems in areas such as
scheduling, matching and network.
The maximum number of edges in a bipartite graph with n nodes can be found using the formula:
Max edges = n * (n – 1) / 2
This formula assumes that the bipartite graph is complete, meaning that there is an edge between every
possible pair of vertices in the two sets. In a complete bipartite graph, the number of edges is equal to
the product of the number of vertices in each set, divided by 2. For example, if the two sets have sizes m
and n, the maximum number of edges is m * n / 2.
The chromatic number of a bipartite graph is the minimum number of colors needed to color the
vertices of the graph such that no two adjacent vertices have the same color. In a bipartite graph, the
chromatic number is always equal to 2. This is because the vertices of a bipartite graph can be colored
with just two colors, one color for the vertices in one set and another color for the vertices in the other
set. All edges connect vertices of different colors, so no two adjacent vertices will have the same color.
A complete bipartite graph is a simple graph that has two disjoint sets of vertices, and every vertex in
one set is connected to every vertex in the other set. It is denoted by K(m,n), where m and n represent
the number of vertices in each set. For example, K(3,2) is a complete bipartite graph with 3 vertices in
one set and 2 vertices in the other set.
The chromatic number of a complete bipartite graph is the minimum number of colors required to color
the vertices of the graph such that no two adjacent vertices have the same color.
For a complete bipartite graph K(m,n), the chromatic number is equal to the maximum of m and n. This
is because a coloring of the graph can be achieved by assigning one color to the vertices in the first set
and a different color to the vertices in the second set, ensuring that no two adjacent vertices have the
same color.
Bipartite structure: A complete bipartite graph is a graph that has two disjoint sets of vertices, and no
edges exist within the same set.
Regularity: All vertices in a complete bipartite graph have the same degree. In K(m,n), the degree of
each vertex is n if it belongs to the first set, and m if it belongs to the second set.
Maximum number of edges: A complete bipartite graph has the maximum number of edges possible
among all bipartite graphs with the same number of vertices.
Chromatic number: The chromatic number of a complete bipartite graph is equal to the maximum of m
and n.
Connectivity: A complete bipartite graph is connected if and only if either m=1 or n=1.
Real-world Applications: Complete bipartite graphs are commonly used in scheduling and resource
allocation problems, where the two sets of vertices represent tasks and resources, respectively.
PLANAR GRAPH:
A planar graph is a graph that can be drawn on a plane without any edges intersecting. In other words,
the edges can be represented as simple curves without any self-intersections. Planar graphs have
important applications in various fields such as network design, geographic information systems, and
VLSI design.
There are several algorithms for checking the planarity of a graph, including:
Kuratowski’s Theorem: A graph is non-planar if and only if it contains a subgraph that is isomorphic to
either K3,3 or K5.
Boyer-Myrvold Algorithm: This is a efficient algorithm that uses depth-first search and planarity testing.
It returns a planar embedding of the graph if the graph is planar and reports a Kuratowski subgraph
otherwise.
Hopcroft-Tarjan Algorithm: This is another efficient algorithm that uses depth-first search and planarity
testing. It is based on the same idea as Boyer-Myrvold Algorithm, but has a slightly different approach.
PLANAR Algorithm: This is a simple linear-time algorithm for checking the planarity of a graph. It works
by successively removing vertices of degree at most 5 until the remaining graph is either a planar graph
or a Kuratowski subgraph.
EULER THEORM:
Euler’s Theorem is a mathematical result that provides a necessary and sufficient condition for a graph
to be planar. The theorem states that a connected graph is planar if and only if it has the following two
properties:
The number of vertices with odd degree in the graph is at most two.
The Euler formula for planarity is a mathematical formula that provides a relationship between the
number of vertices, edges, and faces in a planar graph. The formula is:
V-E+F=2
Where V is the number of vertices, E is the number of edges, and F is the number of faces in the graph.
The formula states that for any planar graph, the number of vertices minus the number of edges plus
the number of faces is equal to two.
This formula is a consequence of the topological properties of planar graphs and has numerous
applications in fields such as computer science, mathematics, and engineering. For example, it can be
used to determine the maximum number of faces in a planar graph or to design efficient algorithms for
planar graph processing.
CHROMATIC NUMBER :
The chromatic number of a graph is the smallest number of colors needed to color the vertices of the
graph such that no two adjacent vertices have the same color.
The chromatic number can vary greatly depending on the graph. Here are some examples:
Cycle graph: The chromatic number of a cycle graph with an even number of vertices is 2, and with an
odd number of vertices is 3.
Note: The chromatic number is an NP-hard problem, meaning that finding the exact chromatic number
for an arbitrary graph is difficult and may require a lot of time and computational resources.
EULER GRAPH:
An Euler graph is a graph that has a closed path that passes through every edge exactly once, known as
an Euler circuit. The concept of Euler graphs was first introduced by the mathematician Leonhard Euler
in the 18th century.
The graph must be connected, meaning that there is a path between every pair of vertices.
All vertices must have even degree, meaning that the number of edges incident to each vertex must be
even.
Euler graphs have numerous applications in fields such as computer science, operations research,
transportation, and electrical engineering. For example, they can be used to model transportation
networks, such as finding the shortest route that visits every city and returns to the starting vertex.
1.euler path is a path in a graph that passes through every edge exactly once. An Euler circuit is a special
case of an Euler path where the path starts and ends at the same vertex, forming a closed loop.
In other words, an Euler path is a walk through a graph that visits every edge exactly once, while an
Euler circuit is a closed walk that visits every edge exactly once and ends at the starting vertex.
Both Euler paths and circuits have important applications in various fields, such as transportation,
computer science, and operations research. For example, Euler paths and circuits can be used to model
the delivery of goods in a transportation network, or to find the shortest route that visits every city and
returns to the starting city.
Connectivity: The graph must be connected, meaning that there is a path between every pair of vertices.
Even degree: All vertices must have even degree, meaning that the number of edges incident to each
vertex must be even.
If both conditions are satisfied, the graph is an Euler graph, and it has either an Euler path or an Euler
circuit. If the graph is not connected, it cannot be an Euler graph. If there is a vertex with odd degree,
the graph cannot be an Euler graph, as it would not be possible to visit every edge exactly once.
There are algorithms, such as Hierholzer’s algorithm, that can be used to find an Euler path or circuit in
an Euler graph in linear
HAMILTANION GRAPH:
A Hamiltonian graph is a graph that contains a Hamiltonian cycle, which is a cycle that passes through
every vertex exactly once. In other words, it is a graph where it’s possible to visit every vertex exactly
once and return to the starting vertex by following a sequence of edges.
Necessary conditions: There are several necessary conditions for a graph to be Hamiltonian, such as the
degree of every vertex must be at least n/2, where n is the number of vertices.
Ore’s theorem: If for every pair of non-adjacent vertices, the sum of their degrees is greater than or
equal to n, then the graph is Hamiltonian.
Dirac’s theorem: If the degree of every vertex is at least n/2, then the graph is Hamiltonian.
Algorithms: There are algorithms to check if a graph is Hamiltonian, such as the backtracking algorithm
and the Fleury’s algorithm.
Note: None of these methods provide a guarantee, they are just sufficient or necessary conditions or
algorithms that can be used to check if a graph is Hamiltonian.
A minimum spanning tree (MST) is a subset of a graph’s edges that connects all nodes together with the
minimum total edge weight. The result is a tree structure (a connected, acyclic graph) with no cycles and
the minimum sum of edge weights among all possible spanning trees. Kruskal’s and Prim’s algorithms
are two common methods to find the MST of a graph.
Connectivity: MST connects all nodes in the graph without forming any cycles.
Minimal Total Weight: The total weight of the edges in the MST is minimized compared to all other
spanning trees.
Unique: MST is unique for a given graph with distinct edge weights.
Subtree of the original graph: Every node in the MST is a node in the original graph and the edges in the
MST form a subtree of the original graph.
Fewer edges: An MST will have fewer edges than the original graph, since it is a tree structure.
PRIMS ALGORITHM:
Prim’s algorithm is a greedy algorithm that finds the minimum spanning tree of a connected, undirected
graph by maintaining a growing tree of minimum weight. The algorithm starts with an arbitrary vertex
and adds edges one by one that connect the growing tree to vertices outside of the tree until all vertices
are included in the tree. The algorithm works as follows:
Initialize a tree with an arbitrary starting vertex.
Select the edge with the minimum weight that connects a vertex in the tree to a vertex outside of the
tree.
Add the newly connected vertex to the tree and mark it as processed.
Prim’s algorithm can be implemented using a priority queue to efficiently keep track of the edges with
the minimum weight that connect the growing tree to vertices outside of the tree.
KRUSKALS ALGORITH:
Kruskal’s algorithm is a greedy algorithm that finds the minimum spanning tree of a connected,
undirected graph by sorting its edges in increasing order of weight and adding them to the tree if they
do not form a cycle. The algorithm works as follows:
a. If adding the edge would not form a cycle, add it to the minimum spanning tree and union the
sets of its two endpoints in the disjoint set data structure.
Repeat step 3 until all vertices are in the same connected component.
Kruskal’s algorithm can be implemented using a disjoint set data structure (e.g. Union-Find) to efficiently
check for cycles and track connected components.
DIJSTRAS ALGORITHM:
Dijkstra’s algorithm is a shortest path algorithm that finds the shortest distance between a source vertex
and all other vertices in a weighted graph. It is a greedy algorithm that maintains a priority queue of
vertices and updates the distance to the target vertex for each neighboring vertex in the graph. The
algorithm works as follows:
Initialize a priority queue with the source vertex and set its distance to 0. Set the distance of all other
vertices to infinity.
a. Extract the vertex with the minimum distance from the priority queue.
b. For each neighbor of the extracted vertex, calculate the distance to the neighbor through the
extracted vertex and update it if it is smaller.
c. Mark the extracted vertex as processed.
The final distance values of all vertices represent the shortest distances from the source vertex.
Dijkstra’s algorithm is guaranteed to find the shortest path in a graph with non-negative edge weights
and can be used to find the shortest path between two vertices in a graph.
The Floyd-Warshall algorithm is an algorithm for finding the shortest paths in a weighted graph between
all pairs of vertices. It is a dynamic programming algorithm that calculates the shortest paths by
iteratively relaxing the distances between vertices. The algorithm works as follows:
Initialize the distance matrix with the edge weights, where the distance between two vertices is set to
the weight of the edge connecting them if it exists, and to infinity if no edge exists.
For each intermediate vertex k, relax the distances between all pairs of vertices (I, j) by checking if the
distance between I and j can be improved by using k as an intermediate vertex:
A. If dist(I, j) > dist(I, k) + dist(k, j), update dist(I, j) to be dist(I, k) + dist(k, j).
Repeat step 2 for all intermediate vertices from 1 to n, where n is the number of vertices in the graph.
The final distance matrix produced by the Floyd-Warshall algorithm represents the shortest distances
between all pairs of vertices in the graph. The algorithm has a time complexity of O(n^3), making it
efficient for small graphs but less efficient for large graphs with many vertices.
The Bellman-Ford algorithm is an algorithm for finding the shortest paths in a weighted graph with
negative edge weights. It is a dynamic programming algorithm that calculates the shortest distances by
iteratively relaxing the distances between vertices. The algorithm works as follows:
Initialize the distance array with the edge weights, where the distance between the source vertex and
each other vertex is set to the weight of the edge connecting them if it exists, and to infinity if no edge
exists.
Repeat the following steps for n-1 times, where n is the number of vertices in the graph:
a. For each vertex I, relax the distances to all its neighbors j by checking if the distance to j can be
improved:
i. If dist(j) > dist(i) + weight(I, j), update dist(j) to be dist(i) + weight(I, j).
Check for negative-weight cycles by repeating step 2 for one more time, and if a distance is relaxed, the
graph contains a negative-weight cycle.
The final distance array produced by the Bellman-Ford algorithm represents the shortest distances from
the source vertex to all other vertices in the graph, provided that the graph does not contain negative-
weight cycles. The algorithm has a time complexity of O(mn), making it efficient for sparse graphs with a
small number of edges, but less efficient for dense graphs with many edges.
REFERENCES:
BOOKS:
SITES:
These websites provide a wealth of information and resources on graph theory, from introductory to
advanced levels. You can also use these links as a starting point to find other related resources.
LAST WORD:
“I imagine that the graph theory will be the science of the 21 st century as number theory was for the
20th.”
~Loal blogs