A
A
Antonzm2016-03-13 14:29:01
Algorithms
Antonzm, 2016-03-13 14:29:01

Looking for a path vector in a graph, is there a graph-wide traversal (using a stack)?

1. There is a breadth walk (not recursive!) (starts from the initial vertex, ends when the desired vertex is reached).
2. There is a stack , and storage , which contains all the vertices in the order they were added to the stack.
How to implement the search for exactly the path vector?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
uvelichitel, 2016-03-14
@Antonzm

In the comments, you specified that you are interested in the optimal path. The optimal breadth traversal path is Dijkstra's algorithm. In short, the stack (path vector) at the position of each vertex is written the name of the last previous one on the shortest path. It is described in detail for example here https://habrahabr.ru/post/111361/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question