Given a binary valued undirected graph with V vertices and E edges, the task is to find the octal equivalents of all the connected components of the graph. A binary valued graph can be considered as having only binary numbers (0 or 1) as the vertex values....
Given two arrays A[] and B[] consisting of N positive integers and a matrix List[][] consisting of M pairs of indices, the task is to minimize the count of unequal same-indexed elements(Ai != Bi) from the two arrays by swapping between any pair of given indices in array A[]....
Given an array A[] of size N, for each index i in the range [0, N) the value A[i] denotes the size of the connected component of node i. The task is to find the edges for the possible graph else print -1....
Given an undirected graph consisting of V vertices and a 2d array E[][2] denoting edges between pairs of nodes. Given another array arr[] representing values assigned to each node, the task is to find the maximum GCD among the GCD of all connected components in the graph....
Given an undirected graph consisting of N vertices and M edges and queries Q[][] of the type {X, Y}, the task is to check if the vertices X and Y are in the same connected component of the Graph....
Given an undirected graph with V vertices and E edges, the task is to find all the connected components of the graph and check if each of their lengths are a Fibonacci number or not. For example, consider the following graph....
Given an undirected graph with V vertices and E edges. Every node has been assigned a given value. The task is to find the connected chain with the maximum sum of values among all the connected components in the graph. Examples:...
Strongly Connected Component (SCC) is a concept in graph theory, specifically in directed graphs. A subgraph of a directed graph is considered to be an SCC if and only if for every pair of vertices A and B, there exists a path from A to B and a path from B to A....
Connected component in an undirected graph refers to a group of vertices that are connected to each other through edges, but not connected to other vertices outside the group....
Given an undirected graph G with vertices numbered in the range [0, N] and an array Edges[][] consisting of M edges, the task is to find the total number of connected components in the graph using Disjoint Set Union algorithm....
Given an undirected graph G with vertices numbered in the range [1, N] and an array Edges[][] consisting of M edges, the task is to check if all triplets of the undirected graph satisfies the transitive property or not. If found to be true, then print “YES”. Otherwise, print “NO”....
Given two integers V and E representing the number of vertices and edges of an undirected graph G(V, E), a list of edges EdgeList, and an array A[] representing the cost to color each node, the task is to find the minimum cost to color the graph using the following operation:...