# Category Archives: Graph

Given a matrix grid[][] with dimension M × N of integers, the task is to print the matrix elements using DFS traversal. Examples:Attention reader! Don’t… Read More
Given an integer N denoting the number of connected cities ( numbered from 1 to N ) and a 2D array arr[][] consisting of pairs… Read More
Given a connected graph, the task is to find the minimum number of edges to cut/remove to make the given graph disconnected. A graph is… Read More
A Successor Graph is a directed graph in which each vertex has outdegree one, i.e., exactly one edge starts at each node. A successor graph… Read More
Given an array arr[] consisting of first N natural numbers, construct an undirected graph using the array elements such that for any array element, connect… Read More
Given a matrix of size M x N consisting of integers, the task is to print the matrix elements using Breadth-First Search traversal. Examples: Input:… Read More
Given n electric components and m electric wires to connect them where each wire has a length. Find the optimized wire length between the two… Read More
A complete graph also called a Full Graph it is a graph that has n vertices where the degree of each vertex is n-1. In… Read More
Cayley’s Formula: This formula tells how many trees can be constructed with N vertices. It states that there are NN – 2  labeled trees that… Read More
Given a 2D array edges[][] of type { X, Y } representing that there is an edge between the node X and Y in a… Read More
Given undirected weighted graph G, the task is to find the Maximum Spanning Tree of the Graph using Prim’s Algorithm Prims algorithm is a Greedy… Read More
An undirected graph is graph, i.e, a set of objects (called vertices or nodes) that are connected together, where all the edges are bidirectional. An… Read More
A path graph is a connected graph denoted by Pn if it contains n nodes. Nodes are connected in form of a straight line in… Read More
Given a graph G complement of the graph is obtained by removing the edges contained in G from the complete graph having the same number… Read More
Tree Edge: It is an edge that is present in the tree obtained after performing DFS on the graph. All the Green edges are tree… Read More