Given a directed weighted graph with N vertices and M edges and an edge (U, V). The task is to find whether there is an… Read More

# Category Archives: Graph

Given a number N which is the number of nodes in a graph, the task is to find the maximum number of edges that N-vertex… Read More

Given a graph with N nodes, a node S and Q queries each consisting of a node D and K, the task is to find… Read More

Prerequisite: Graph and its representations Given a adjacency matrix representation of a Graph. The task is to convert the given Adjacency Matrix to Adjacency List representation. Examples: … Read More

Prerequisite: Segment tree and depth first search.In this article, an approach to convert an N-ary rooted tree( a tree with more than 2 children) into… Read More

Prerequisites: Genetic Algorithm, Travelling Salesman ProblemIn this article, a genetic algorithm is proposed to solve the travelling salesman problem. Genetic algorithms are heuristic search algorithms inspired… Read More

Given a small graph with N nodes and E edges, the task is to find the maximum clique in the given graph. A clique is… Read More

Given an undirected graph with N nodes and E edges and a value K, the task is to print all set of nodes which form… Read More

Prerequisites: Linked List, Graph Data Structure In this article, adding and removing a vertex is discussed in a given adjacency list representation.Attention reader! Don’t stop… Read More

Prerequisites: Graph and Its RepresentationIn this article, adding and removing edge is discussed in a given adjacency list representation. A vector has been used to implement… Read More

Given a directed graph with N nodes and E edges where the weight of each of the edge is > 1, also given a source… Read More

Given a bi-directed weighted (positive) graph without self-loops, the task is to generate the minimum spanning tree of the graph.Examples: Input: N = 9, E… Read More

Given a directed weighted graph and two vertices S and D in it, the task is to find the shortest path from S to D… Read More

Given N nodes on a 2-D plane represented as (xi, yi). The nodes are said to be connected if the manhattan distance between them is… Read More

Given a graph with N nodes having values either P or M. Also given K pairs of integers as (x, y) representing the edges in… Read More