Category Archives: Graph

Given the number of vertices N of a graph. The task is to determine the Edge cover.Edge Cover: Minimum number of edge required to cover… Read More
Cycle:- cycle is a path of edges and vertices wherein a vertex is reachable from itself. or in other words, it is a Closed walk. … Read More
Given N number of vertices of a Graph. The task is to find the total number of edges possible in a complete graph of N… Read More
Give a complete graph with N-vertices. The task is to find out the maximum number of edge-disjoint spanning tree possible.Edge-disjoint Spanning Tree is a spanning… Read More
The level ancestor problem is the problem of preprocessing a given rooted tree T into a data structure that can determine the ancestor of a… Read More
Given an undirected and unweighted graph. The task is to find the product of the lengths of all cycles formed in it.Example 1:     The… Read More
Below are the steps for finding MST using Kruskal’s algorithm   1. Sort all the edges in non-decreasing order of their weight. 2. Pick the smallest edge.… Read More
We have discussed Prim’s algorithm and its implementation for adjacency matrix representation of graphs. As discussed in the previous post, in Prim’s algorithm, two sets are… Read More
Given an undirected weighted graph. The task is to find the minimum cost of the path from source node to the destination node via an… Read More
Given an undirected graph, print all the vertices that form cycles in it. Pre-requisite: Detect Cycle in a directed graph using colors   In the above diagram,… Read More
In graph theory, a dominating set for a graph G = (V, E) is a subset D of V such that every vertex not in… Read More
Given a graph, the task is to print the DFS traversal of a graph which includes every step including the backtracking. 1st step:- 0 ->… Read More
Given an array of words, find any alphabetical order in the English alphabet such that the given words can be considered sorted (increasing), if there… Read More
Graphs can be used for seemingly unconnected problems. Say the problem of cards which have numbers on both side and you try to create a… Read More
A graph is a non-linear data structure, which consists of vertices(or nodes) connected by edges(or arcs) where edges may be directed or undirected. In Computer… Read More