## Clone a Directed Acyclic Graph

A directed acyclic graph (DAG) is a graph which doesn’t contain a cycle and has directed edges. We are given a DAG, we need to… Read More »

A directed acyclic graph (DAG) is a graph which doesn’t contain a cycle and has directed edges. We are given a DAG, we need to… Read More »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »

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 »