Pre-requisites: Graph and its representations Greedy Algorithms | Set 5 (Prim’s Minimum Spanning Tree (MST)) Kruskal’s Minimum Spanning Tree Algorithm | Greedy Algo-2 Given a… Read More

# Category Archives: Graph

Given a graph and a source vertex src in a weighted undirected graph, find the shortest paths from src to all vertices in the given… Read More

Given a directed and unweighted graph consisting of N vertices and an array arr[] where ith vertex have a directed edge to arr[i]. The task… Read More

Given Adjacency List representation of a tree and an integer K., the task is to find whether the given tree can be split into K… Read More

Given an acyclic undirected graph having N nodes and N-1 edges in the form of a 2D array arr[][] in which every row consists of… Read More

Given a graph with N vertices and E edges. The edges are given as U[] and V[] such that for each index i, U[i] is… Read More

Prerequisites: Bellman-Ford AlgorithmGiven a directed weighted graph with V vertices, E edges and a source vertex S. The task is to find the shortest path… Read More

Given adjacency list representation of a directed graph, the task is to check whether the cost of going from any vertex to any other vertex… Read More

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

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