M
M
Maxim Zolotoy2018-10-31 21:18:56
Algorithms
Maxim Zolotoy, 2018-10-31 21:18:56

How to find the shortest path in a graph by breadth-first search?

In the description of the breadth-first search algorithm, it says "so you will find the shortest path to a given point"
But in fact, I just find out if there is a given node in the graph or not.
How can I find out the path? (list of nodes through which the path goes)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2018-10-31
@Rsa97

When adding a node to the bypass queue, mark from which node you came to it. Once you have reached your destination, reverse the route.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question