Given an undirected graph with N vertices and M edges. The task for this problem is to check whether each connected component of the given… Read More
Category Archives: Graph
Given an undirected graph, a source node src, and an integer K, the task is to print all nodes after level K from the source… Read More
A bipartite graph is a graph in which the vertices can be divided into two disjoint sets, such that no two vertices within the same… Read More
A complete graph is an undirected graph in which every pair of distinct vertices is connected by a unique edge. In other words, every vertex… Read More
A directed graph of V vertices and E edges is given in the form of an adjacency list adj. Each node of the graph is… Read More
Given a graph in the form of an edge list and a directed graph, return all the ancestors of the nodes in any order. An… Read More
Given an unweighted directed graph with N vertices and M edges and array A[] of size N. Given Q queries of the form (U, V),… Read More
Given a maze with N cells. Each cell may have multiple entry points but not more than one exit (i.e entry/exit points are unidirectional doors… Read More
Given a graph containing n edges. The task is to find the topology formed by the given set of edges in that graph. Examples: Input:… Read More
In graph theory, the data/objects belong to the same group but each piece of data differs from one other. In this article, we will see… Read More
Given an array vals[] of size N, where each element represents the value of each node (0 ≤ index ≤ N-1) and an array Edges[]… Read More
What is Fusion operation in Graph Theory? Let u and v be two distinct vertices in graph G. The fusion of the vertices u and… Read More
In graph theory, a partial k-tree (also known as a partial k-tree decomposition) is a graph-theoretic model that can be used to represent and solve… Read More
In graph theory, a clique is a subset of vertices of an undirected graph such that every two distinct vertices in the clique are adjacent,… Read More
Given a graph with n nodes and m edges, each edges[i] = [u, v, weight] and d as the maximum distance to reach the neighbor… Read More