Return all ShortestPath explored nodes

Is there a way for me to get a list of all explored nodes in the function
shortestpath(G,s,t)
Or if there is a different way that I can get a list of all explored nodes in BFS and Dijkstra

Respuestas (2)

Aparajith Raghuvir
Aparajith Raghuvir el 7 de Jul. de 2021
I understand you need to get a list of all explored nodes in BFS and Djikstra's shortest path algorithms
You may run the following code
edit shortestpath
This would give you the source code of the shortestpath function that you may modify to extract the list of all explored nodes

4 comentarios

Steven Lord
Steven Lord el 7 de Jul. de 2021
If you are using the shortestpath function included in MATLAB, please do not modify that source code!
Why do you need the information about the steps the shortest path function took internally in the course of its calculations?
Aparajith Raghuvir
Aparajith Raghuvir el 7 de Jul. de 2021
The user Saharsh Bansal wanted to know the internal steps that the algorithm used. In case I was not clear, I do not suggest changing the source code, but using the source code as a reference to build your own custom function that outputs all explored nodes
Bruno Luong
Bruno Luong el 7 de Jul. de 2021
Aparajith Raghuvir have you tried it? The shortestpath file is a wrapper, the algorithm (such as bfsShortestPaths) seems to run on non-m file.
Aparajith Raghuvir
Aparajith Raghuvir el 8 de Jul. de 2021
Oh, if that is the case then unfortunately you may need to code the algorithms yourself to get all nodes that were explored as part of it.

Iniciar sesión para comentar.

Categorías

Más información sobre Graph and Network Algorithms en Centro de ayuda y File Exchange.

Productos

Versión

R2020a

Etiquetas

Preguntada:

el 3 de Jul. de 2021

Comentada:

el 8 de Jul. de 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by