# Tag Archives: Shortest Path

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[]. 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
Spanning tree: A spanning tree (T) of an undirected graph(G) is a subgraph which is a tree that includes all the vertices of a graph… Read More
Given a weighted undirected graph T consisting of nodes valued [0, N – 1] and an array Edges[] of type {u, v, w} that denotes… Read More
Given two strings start and target(both of the same length) and a list of strings str[], the task is to print all possible smallest sequences… Read More
Given a source node S, a sink node T, two matrices Cap[ ][ ] and Cost[ ][ ] representing a graph, where Cap[i][j] is the… Read More
Given a graph of N Nodes and E edges in form of {U, V, W} such that there exists an edge between U and V… Read More
Given a weighted, directed graph G, an array V[] consisting of vertices, the task is to find the Minimum Cost Path passing through all the… Read More