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 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

Connected Graph Property Explained With Simple Example

Graph is a data structure which consists of 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.

A Graph is called connected graph if each of the vertices of the graph is connected from each of the other vertices which means there is a path available from any vertex to any other vertex in the Graph.

Before going ahead have a look into Graph Basics.

(more…)
Connected Graph Property Explained With Simple Example Read More

Topological Sort Explained With Simple Example

Topological sort is a method to sort the vertices in directed acyclic graph in which each node comes before all the nodes to which it has edges going to. Topological sort is mainly used in cases where a certain node can be visited if and only if certain nodes has been visited before.

A Directed Acyclic graph or DAG is a graph which doesn’t have any cycle.

All pairs of consecutive vertices in topological sorted order are connected by edges which forms a directed Hamiltonian Path.

(more…)
Topological Sort Explained With Simple Example Read More

Breadth first search for a Graph

Traversal of a Graph means visiting each and every nodes present in the Graph. Traversal can be done using various approaches and here we are going to talk about one of most famous and useful traversal algorithm known as Breadth first search (BFS). In this algorithm, backtracking and recursion is being used along with a Queue to visit all the nodes. Before going ahead have a look into Graph Basics.

(more…)

Breadth first search for a Graph Read More

Depth first search for a Graph

Traversal of a Graph means visiting each and every nodes present in the Graph. Traversal can be done using various approaches and here we are going to talk about one of most famous and useful traversal algorithm known as Depth first search (DFS). In this algorithm, backtracking and recursion is being used along with a Stack to visit all the nodes. Before going ahead have a look into Graph Basics.

(more…)

Depth first search for a Graph Read More

Graph and its basic implementation

Graph is a data structure which consists 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.
Before going ahead have a look into Graph Basics.

(more…)

Graph and its basic implementation Read More

Graph basics and representation

Graph is a data structure which consists 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 wasy to go from A to B etc.

(more…)
Graph basics and representation Read More