##
Minimum number of edges between two vertices of a Graph
June 21, 2017

You are given a undirected graph G(V, E) with N vertices and M edges. We need to find the minimum number of edges between a… Read More »

June 21, 2017

You are given a undirected graph G(V, E) with N vertices and M edges. We need to find the minimum number of edges between a… Read More »

Given an undirected tree with some marked nodes and a positive number K. We need to print the count of all such nodes which have… Read More »

June 11, 2017

Searching a graph is quite famous problem and have a lot of practical use. We have already discussed here how to search for a goal… Read More »

June 6, 2017

Determine whether a universal sink exists in a directed graph. A universal sink is a vertex which has no edge emanating from it, and all… Read More »

June 5, 2017

Dynamic connectivity is a data structure that dynamically maintains the information about thee connected components of graph. In simple words suppose there is a graph… Read More »

June 2, 2017

Given a directed tree with V vertices and V-1 edges, we need to choose such a root (from given nodes from where we can reach… Read More »

May 17, 2017

Given a directed and strongly connected graph with non negative edge weighs. We define mean weight of a cycle as the summation of all the… Read More »

In previous post, BFS only with a particular vertex is performed i.e. it is assumed that all vertices are reachable from the starting vertex. But… Read More »

May 10, 2017

Given a weighting scale and an array of different positive weights where we have an infinite supply of each weight. Our task is to put… Read More »

May 7, 2017

Given a undirected graph of n nodes and m edges. The task is to find minimum edges required to make Euler Circuit in the given… Read More »

May 4, 2017

Given a Directed Acyclic Graph of n nodes (numbered from 1 to n) and m edges. The task is to find the number of sink… Read More »

May 3, 2017

Prerequisites : BFS, DFS In BFS and DFS, when we are at a node, we can consider any of the adjacent as next node. So… Read More »

May 1, 2017

Depth-first search (DFS) is an algorithm for traversing or searching tree or graph data structures. One starts at the root (selecting some arbitrary node as… Read More »

Given an undirected complete graph with N nodes or vertices. Edges of the graph are colored, find the largest subset of vertices with edges of… Read More »

April 23, 2017

Given a graph where every edge has weight as either 0 or 1. A source vertex is also given in the graph. Find the shortest… Read More »