Given a weighted directed graph with N vertices and M edges, a source src and a destination target, the task is to find the shortest… Read More
Tag Archives: Shortest Path
Given a Grid of size NxM, and two integers X and Y, the task is to count the minimum number of rows between the row… Read More
Minimum cost of path between given nodes containing at most K nodes in a directed and weighted graph
Given a directed weighted graph represented by a 2-D array graph[][] of size n and 3 integers src, dst, and k representing the source point,… Read More
Given a matrix of N*M order. Find the shortest distance from a source cell to a destination cell, traversing through limited cells only. Also you… Read More
Given a matrix of N*M order. Find the shortest distance from a source cell to a destination cell, traversing through limited cells only. Also you… Read More
Given a matrix mat[][] and an integer K, the task is to find the length of the shortest path in a matrix from top-left to… Read More
Johnson’s algorithm finds the shortest paths between all pairs of vertices in a weighted directed graph. It allows some of the edge weights to be… Read More
Given a weighted undirected graph consisting of N nodes and M edges, the task is to find the shortest distance between two nodes A and… Read More
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
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 source and destination in a matrix[][] of infinite rows and columns, the task is to find whether it is possible to reach the… 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
The shortest path problem is the problem of finding a path between two vertices (or nodes) in a graph such that the sum of the… Read More
Given a weighted undirected graph G and an integer S, the task is to print the distances of the shortest paths and the count of… Read More