Top "Shortest-path" questions

Shortest path problems are problems addressing finding the shortest path from a single source to a target source, usually in a graph.

How does a Breadth-First Search work when looking for Shortest Path?

I've done some research, and I seem to be missing one small part of this algorithm. I understand how a …

java shortest-path breadth-first-search
Why doesn't Dijkstra's algorithm work for negative weight edges?

Can somebody tell me why Dijkstra's algorithm for single source shortest path assumes that the edges must be non-negative. I …

algorithm shortest-path dijkstra
Negative weights using Dijkstra's Algorithm

I am trying to understand why Dijkstra's algorithm will not work with negative weights. Reading an example on Shortest Paths, …

algorithm dijkstra shortest-path graph-algorithm
Bellman-Ford vs Dijkstra: Under what circumstances is Bellman-Ford better?

After a lot of Googling, I've found that most sources say that the Dijkstra algorithm is "more efficient" than the …

algorithm dijkstra shortest-path bellman-ford
How to calculate the shortest path between two points in a grid

I know that many algorithms are available for calculating the shortest path between two points in a graph or a …

algorithm shortest-path
Knight's Shortest Path on Chessboard

I've been practicing for an upcoming programming competition and I have stumbled across a question that I am just completely …

chess shortest-path minimization search-tree
What is meant by diameter of a network?

The diagram shown on this link of the "A graph with 6 vertices and 7 edges where the vertex no 6 on the …

graph-theory terminology shortest-path
Finding all the shortest paths between two nodes in unweighted undirected graph

I need help finding all the shortest paths between two nodes in an unweighted undirected graph. I am able to …

algorithm graph shortest-path breadth-first-search
What is the difference between Dijkstra and Prim's algorithm?

What is the exact difference between Dijkstra's and Prim's algorithms? I know Prim's will give a MST but the tree …

algorithm shortest-path
Shortest path (fewest nodes) for unweighted graph

I'm trying build a method which returns the shortest path from one node to another in an unweighted graph. I …

java algorithm graph shortest-path breadth-first-search