# Category Archives: Graph

Given an undirected graph consisting of N vertices and M edges and an array edges[][], with each row representing two vertices connected by an edge,… Read More
Data structures are divided into two categories Linear data structures and Non-Linear data structures. The major disadvantage of the linear data structure is we cannot… Read More
Given N nodes valued by [1, N], an array arr[] consisting of N positive integers such that the ith node ( 1-based indexing ) has… Read More
Given an undirected weighted graph G consisting of N vertices and M edges, and two arrays Edges[] and Weight[] consisting of M edges of the… Read More
Given two graphs G1 and G2, the task is to find the union and intersection of the two given graphs, i.e. (G1 ∪ G2) and… Read More
Graph Coloring is the method to assign colors to certain elements of a graph. The most common method for this is the Vertex Coloring Method.… Read More
Given an adjacency matrix adj[][] of an undirected graph consisting of N vertices, the task is to find whether the graph contains a Hamiltonian Path… Read More
Given a Directed Tree consisting of N nodes, the task is to check if there exists a node in the given tree such that all… Read More
Given a matrix arr[][], consisting of only 0, 1, and 2, that represents an empty ward, an uninfected patient, and an infected patient respectively. In… Read More
For a connected and undirected graph, a spanning tree of that graph is a subgraph that is a tree and connects all the vertices together.… Read More
Given a directed weighted graph consisting of N vertices and an array Edges[][], with each row representing two vertices connected by an edge and the… Read More
Independent sets are set of vertices or edges in which the pair of any two vertices or edges are not adjacent to each other. Assuming… Read More
Gabow’s Algorithm is a scaling algorithm that aims in solving a problem by initially considering only the highest order bit of each relevant input value… Read More
Given an N-ary tree consisting of N nodes numbered from 1 to N rooted at node 1, the task is to assign values to each… Read More
Given an integer N, representing the number of stairs, valued from 1 to N, and a starting position S, the task is to count the… Read More