Graph data structures explained

Graph data structures contains a set of vertices which is called as Node, together with a set of collection of pair of vertices which is called as an Edge.
A graph data structure can be represented as a pair (V, E) where V is a set of nodes called vertices and E is a collection of pairs of vertices called edges.
Graphs are used to solve many real life problems such as fastest ways to go from A to B etc.

Let’s have a look into some graphical examples of Graphs.

(more…)
Graph data structures explained Read More

Bellman Ford’s Shortest Path Algorithm

Shortest path algorithms are designed to find the minimum cost path between two nodes in a graph. This algorithm can be used to find out the fastest way to reach from one place to another or it can be used to find cheapest way to fly or travel between source and destination.
A weighted graph is a graph in which every edge is not of same weight. In this weighted graph, we have to find the shortest path to all the vertices from a given vertices.
Before going ahead have a look into Graph Basics.

(more…)
Bellman Ford’s Shortest Path Algorithm Read More

Dijsktra Shortest Path Algorithm Explained with Simple Example

Shortest path algorithms are designed to find the minimum cost path between two nodes in a graph. This algorithm can be used to find out the fastest way to reach from one place to another or it can be used to find cheapest way to fly or travel between source and destination.
A weighted graph is a graph in which every edge is not of same weight. In this weighted graph, we have to find the shortest path to all the vertices from a given vertices.
Before going ahead have a look into Graph Basics.

(more…)
Dijsktra Shortest Path Algorithm Explained with Simple Example Read More

Shortest Path in an Unweighted Graph Using BFS

Shortest path algorithms are designed to find the minimum cost path between two nodes in a graph.
For example, a shortest path algorithm can be used to find the fastest route between two places or the minimum number of connections required to reach one point from another.
An unweighted graph is a graph in which all the edges are of same cost. Therefore, the shortest path is simply the path with the minimum number of edges.
The easiest way to find the shortest path in an unweighted graph is by using BFS (Breadth First Search).
Before going ahead, you can have a look at Graph Basics if you are not familiar with graph representation..

(more…)
Shortest Path in an Unweighted Graph Using BFS Read More