Skip to content

Category Archives: Graph

Given a connected undirected weighted graph in the form of a 2D array where each row is of the type [start node, end node, weight]… Read More
Given a undirected graph with V vertices and E edges. The task is to perform DFS traversal of the graph. Examples: Input: V = 7,… Read More
Given an array arr[] of size N and an integer K, the task is to find the longest subsequence such that the difference between adjacents… Read More
Given two integers N and M denoting the number of vertices and edges in the graph and array edges[][] of size M, denoting an edge… Read More
Given a graph root, the task is to find the length of the longest increasing sequence in the graph. Example: Input:   root =     7—-17 … Read More
Given a graph root, and a value K, the task is to find the number of nodes in the graph whose sum of neighbors is… Read More
Given two integers N and M, the task is to calculate the minimum number of moves to change N to M, where In one move… Read More
Given a graph consisting of N nodes and an array edges[][] denoting an edge from edges[i][0] with edges[i][1]. Given a node K, the task is… Read More
Graph colouring is the task of assigning colours to the vertices of a graph so that: pairs of adjacent vertices are assigned different colours, and… Read More
Pre-requisites: Handshaking theorem. Pendant Vertices  Let G be a graph, A vertex v of G is called a pendant vertex if and only if v… Read More
Given an undirected graph with N nodes and two vertices S & T, the task is to check if a cycle between these two vertices… Read More
Given a complete directed graph having N vertices, whose edges weighs ‘1’ or ‘0’, the task is to find a path of length exactly K… Read More
Given an adjacency matrix graph[][] of a weighted graph consisting of N nodes and positive weights, the task for each connected component of the graph… Read More
Weakly Connected Graph: A directed graph ‘G = (V, E)’ is weakly connected if the underlying undirected graph Ĝ is connected.  The underlying undirected graph… Read More
Given a positive integer K and a weighted undirected connected graph of N nodes and E edges as an array Edges[] of the type {u,… Read More

Start Your Coding Journey Now!