Given a directed graph G N nodes and E Edges consisting of nodes valued [0, N – 1] and a 2D array Edges[][2] of type… Read More

# Tag Archives: Graph Traversals

Given a graph G consisting of nodes valued [0, N – 1], a source S, and an array Edges[][3] of type {u, v, w} that… Read More

Given a weighted undirected graph T consisting of nodes valued [0, N – 1] and an array Edges[][3] of type {u, v, w} that denotes… Read More

Given an n-ary tree T, the task is to find a node whose removal minimizes the maximum size of all forests(connected components) generated. Examples: Input: … Read More

Given an undirected graph G with N nodes, M edges, and an integer K, the task is to find the maximum count of edges that… Read More

Given an undirected graph with N vertices and K edges, the task is to check if for every combination of three vertices in the graph,… Read More

Given a connected acyclic graph consisting of V vertices and E edges, a source vertex src, and a destination vertex dest, the task is to… Read More

Given a matrix arr[][] of dimensions N * M, having elements 0, 1, and 2. There is only one cell with value 1 present in… Read More

Given an undirected graph consisting of N nodes containing values from the range [1, N] and M edges in a matrix Edges[][], the task is… Read More

Given an undirected graph G, with V vertices and E edges, the task is to check whether the graph is 2-edge connected or not. A… Read More

Given a Directed Acyclic Graph having V vertices and E edges, where each edge {U, V} represents the Jobs U and V such that Job… Read More

Given a binary matrix mat[][] of dimensions NxM such that 1 denotes the island and 0 denotes the water. The task is to find the… Read More

Given two integers R and C, denoting the number of rows and columns in a matrix, and two integers X and Y, the task is… Read More

Given a Directed Graph consisting of N vertices and M edges and a set of Edges[][], the task is to check whether the graph contains… Read More

Given an adjacency list representation of a Graph, the task is to convert the given Adjacency List to Adjacency Matrix representation. Examples: Input: adjList[] =… Read More