Given an undirected graph and a set of vertices, we have to count the number of non reachable nodes from the given head node using… Read More »
Given a array arr of n integers. For every value arr[i], we can move to arr[i] + 1 clockwise considering array elements in cycle. We… Read More »
Given n friends and their friendship relations, find the total number of groups that exist. And the number of ways of new groups that can… Read More »
Given an undirected and connected graph and a number n, count total number of cycles of length n in the graph. A cycle of length… Read More »
A disconnected Graph with N vertices and K edges is given. The task is to find the count of singleton sub-graphs. A singleton graph is… Read More »
Given a weighted and undirected graph, we need to find if a cycle exist in this graph such that the sum of weights of all… Read More »
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 »
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 »
A DAG is given to us, we need to find maximum number of edges that can be added to this DAG, after which new graph… Read More »
Given an undirected graph and a set of vertices, find all reachable nodes from every vertex present in the given set. Consider below undirected graph… Read More »
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 »
What is a Mother Vertex? A mother vertex in a graph G = (V,E) is a vertex v such that all other vertices in G… Read More »
Given a graph G and an integer K, K-cores of the graph are connected components that are left after all vertices of degree less than… Read More »
Given an undirected graph, print all connected components line by line. For example consider the following graph.
Given an undirected and unweighted graph, find the smallest cut (smallest number of edges that disconnects the graph into two components).