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

Shortest path in unweighted graph 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.
An unweighted graph is a graph in which all the edges are of same cost. In this unweighted graph, we have to find the shortest path to all the vertices from a given vertices. This algorithm is very much similar to BFS.
Before going ahead have a look into Graph Basics.

(more…)
Shortest path in unweighted graph explained with simple example Read More