##
Transitive closure of a graph
December 4, 2012

Given a directed graph, find out if a vertex j is reachable from another vertex i for all vertex pairs (i, j) in the given… Read More »

December 4, 2012

Given a directed graph, find out if a vertex j is reachable from another vertex i for all vertex pairs (i, j) in the given… Read More »

December 1, 2012

Given a graph and a source vertex src in graph, find shortest paths from src to all vertices in the given graph. The graph may… Read More »

November 27, 2012

We recommend to read following two posts as a prerequisite of this post. 1. Greedy Algorithms | Set 7 (Dijkstra’s shortest path algorithm) 2. Graph and… Read More »

November 25, 2012

Given a graph and a source vertex in graph, find shortest paths from source to all vertices in the given graph.

November 23, 2012

We recommend to read following two posts as a prerequisite of this post.

November 18, 2012

We have discussed Kruskal’s algorithm for Minimum Spanning Tree. Like Kruskal’s algorithm, Prim’s algorithm is also a Greedy algorithm. It starts with an empty spanning tree.

November 13, 2012

Graph is a data structure that consists of following two components: 1. A finite set of vertices also called as nodes. 2. A finite set… Read More »

October 30, 2012

What is Minimum Spanning Tree? Given a connected and undirected graph, a spanning tree of that graph is a subgraph that is a tree and… Read More »

October 28, 2012

In the previous post, we introduced union find algorithm and used it to detect cycle in a graph.

A disjoint-set data structure is a data structure that keeps track of a set of elements partitioned into a number of disjoint (non-overlapping) subsets.

October 17, 2012

Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains 5… Read More »

June 7, 2012

The Floyd Warshall Algorithm is for solving the All Pairs Shortest Path problem. The problem is to find shortest distances between every pair of vertices… Read More »

May 4, 2012

Hamiltonian Path in an undirected graph is a path that visits each vertex exactly once. A Hamiltonian cycle (or Hamiltonian circuit) is a Hamiltonian Path… Read More »

April 10, 2012

Given a Directed Graph and two vertices in it, check whether there is a path from the first given vertex to second.

April 3, 2012

Given a directed graph, check whether the graph contains a cycle or not. Your function should return true if the given graph contains at least… Read More »