Skip to content

Category Archives: Graph

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… Read More
Given an Undirected Graph consisting of N vertices and M edges, where node values are in the range [1, N], and vertices specified by the… Read More
Given a matrix board[][] consisting of the characters K or k, Q or q, B or b, N or n, R or r, and P… Read More
Given a Directed graph of N vertices and M edges, the task is to find the minimum number of edges required to make the given… Read More
Prerequisites: Graph and its representationsGiven an adjacency matrix g[][] of a graph consisting of N vertices, the task is to modify the matrix after insertion… Read More
Given an un-directed and unweighted connected graph, find a simple cycle in that graph (if it exists). Simple Cycle: A simple cycle is a cycle… Read More
Given a 2D screen arr[][] where each arr[i][j] is an integer representing the color of that pixel, also given the location of a pixel (X,… Read More
Every beginner computer science student would have once wondered why do we find shortest path in graph or what is the use of trees, are… Read More
Given a weighted, directed graph G, an array V[] consisting of vertices, the task is to find the Minimum Cost Path passing through all the… Read More
Given an integer N, which denotes the size of the matrix that is N*N. There is a robot placed over the top-left corner (0, 0)… Read More
Graph is composed of set of vertices(denoted as V) and set of edges(denoted as E). The graph is denoted by G(E, V).Attention reader! Don’t stop… Read More
Given a directed Graph G(V, E) with V vertices and E edges, the task is to check that for all vertices of the given graph,… Read More
Given an undirected graph and two vertices X and Y, our task is to check whether the vertex X lies in the subgraph of the… Read More
Given an undirected graph defined by the number of vertex V and the edges E[ ], the task is to find Maximal Independent Vertex Set… Read More