Skip to content

Category Archives: Graph

Dijkstra’s Algorithm: It is a graph searching algorithm that uses a Greedy Approach to find the shortest path from the source node to all other… Read More
Mother vertex: A mother vertex in a Graph G = (V, E) is a vertex v such that all other vertices in  G can be… Read More
Given an unweighted bidirectional graph containing N nodes and M edges represented by an array arr[][2]. The task is to find the difference in length… Read More
Given a directed and weighted graph of N nodes and M edges, the task is to count the number of shortest length paths between node… Read More
Given a graph consisting of N nodes, where each node represents an exam and a 2D array Edges[][2] such that each pair of the exam… Read More
An Adjacency List is used for representing graphs. Here, for every vertex in the graph, we have a list of all the other vertices which… Read More
Problem Description: A city is represented as a two-dimensional rectangular matrix. The outer wall of the given matrix denotes the boundaries of the city. Citizens… Read More
Prerequisites – Graph, Spanning tree, Disjoint Set (Union – Find). A minimum spanning tree (MST) T, for a given graph G, spans over all vertices… Read More
Given an array arr[] consisting of N integers, the task is to find the minimum cost to sort the given array arr[] in ascending order… Read More
Given a 2D array, arr of size N*N where arr[i][j] denotes the cost to complete the jth job by the ith worker. Any worker can… Read More
Given an array arr[] of N pairs of strings representing a directed graph, where each pair of the strings represents an edge between the nodes… Read More
Given an undirected connected graph of N nodes and M edges. Each node has a light but at a time it can be either green… Read More
Given a directed and weighted graph of N nodes and M edges, the task is to find the 1st to Kth shortest path lengths from… Read More
Given a positive integer N denoting the number of astronauts(labelled from 0 from (N – 1))and a matrix mat[][] containing the pairs of astronauts that… Read More