##
Sum of dependencies in a graph
March 9, 2017

Given a directed and connected graph with n nodes. If there is an edge from u to v then u depends on v. Our task… Read More »

March 9, 2017

Given a directed and connected graph with n nodes. If there is an edge from u to v then u depends on v. Our task… Read More »

March 7, 2017

Given an adjacency list representation undirected graph. Write a function to count the number of edges in the undirected graph. Expected time complexity : O(V)… Read More »

February 28, 2017

Given positive weighted undirected graph, find minimum weight cycle in it. Examples: Minimum weighted cycle is : Minimum weighed cycle : 7 + 1 +… Read More »

February 27, 2017

Given a N X N matrix (M) filled with 1 , 0 , 2 , 3 . Find the minimum numbers of moves needed to… Read More »

February 25, 2017

Problem Statement : Given a graph which represents a flow network where every edge has a capacity. Also given two vertices source ‘s’ and sink… Read More »

February 21, 2017

Given a directed graph, find out whether the graph is strongly connected or not. A directed graph is strongly connected if there is a path… Read More »

February 19, 2017

Maximum flow problems involve finding a feasible flow through a single-source, single-sink flow network that is maximum. Let’s take an image to explain how above… Read More »

Given a square chessboard of N x N size, the position of Knight and position of a target is given. We need to find out… Read More »

February 18, 2017

Reverse Delete algorithm is closely related to Kruskal’s algorithm. In Kruskal’s algorithm what we do is : Sort edges by increasing order of their weights.… Read More »

Given an undirected graph and an edge, the task is to find if the given edge is a bridge in graph, i.e., removing the edge… Read More »

February 1, 2017

If a graph is a complete graph with n vertices, then total number of spanning trees is n(n-2) where n is the number of nodes… Read More »

Chinese Postman Problem is a variation of Eulerian circuit problem for undirected graphs. An Euler Circuit is a closed walk that covers every edge once… Read More »

January 22, 2017

Given a directed Eulerian graph, print an Euler circuit. Euler circuit is a path that traverses every edge of a graph, and the path ends… Read More »

January 20, 2017

In Set 1, unweighted graph is discussed. In this post, weighted graph representation using STL is discussed. The implementation is for adjacency list representation of… Read More »

January 19, 2017

We have introduced Graph basics in Graph and its representations. In this post, a different STL based representation is used that can be helpful to… Read More »