Given an undirected unweighted graph. The task is to find the length of the shortest cycle in the given graph. If no cycle exists print… Read More

# Tag Archives: Dijkstra

Given a number N, find the minimum possible sum of digits that can be obtained from a positive Multiple of N. Constraints : 1<=N<=10^5.Attention reader!… Read More

Given a directed weighted graph and the source and destination vertex. The task is to find the sum of shortest distance on the path going… Read More

Given a connected graph with N vertices and M edges. The task is to find the shortest path from source to the destination vertex such… Read More

Given a Weighted Directed Graph and a destination vertex in the graph, find the shortest distance from all vertex to the destination vertex.Input : 1… Read More

Uniform-Cost Search is a variant of Dijikstra’s algorithm. Here, instead of inserting all vertices into a priority queue, we insert only source, then one by… Read More

Dijkstra’s algorithm is very similar to Prim’s algorithm for minimum spanning tree. Like Prim’s MST, we generate a SPT (shortest path tree) with a given… Read More

Prerequisite: Dijkstra’s shortest path algorithm Given an adjacency matrix graph representing paths between the nodes in the given graph. The task is to find the shortest… Read More

Given an undirected weighted graph. The task is to find the minimum cost of the path from source node to the destination node via an… Read More

Main Purposes: Dijkstra’s Algorithm is one example of a single-source shortest or SSSP algorithm, i.e., given a source vertex it finds shortest path from source… Read More

Given a positive weighted undirected graph, find the minimum weight cycle in it. Examples: Attention reader! Don’t stop learning now. Get hold of all the important… Read More

Dijkstra’s shortest path algorithm runs in O(Elog V) time when implemented with adjacency list representation (See C implementation and STL based C++ implementations for details).… Read More

Given a graph and a source vertex in graph, find shortest paths from source to all vertices in the given graph. Input : Source =… Read More

Given a graph and a source vertex in graph, find shortest paths from source to all vertices in the given graph. Attention reader! Don’t stop… Read More