Borrar filtros
Borrar filtros

Rewriting graphtraverse using bfsearch/dfsearch

5 visualizaciones (últimos 30 días)
Dmitrii
Dmitrii el 28 de Sept. de 2022
Respondida: Ayush el 8 de Sept. de 2023
Hi, I am having trouble with rewriting graphtraverse (now deprecated) using bfsearch.
In particular, I want to make this line work with R2022b:
[D,P]=graphtraverse(G,n);
Where G is graph and n is node of interest. As I understand, function returns D -- indices of discovered nodes, and P -- indices of predecessor nodes. Ideally, i want to replace this line of code using bfsearch instead of graphtraverse so it returns same outputs.
It looks like bfsearch doesn't return predecessor indices, only discoverd nodes, judging by documentation.
Would you kindly help me to navigate this issue?
  2 comentarios
Lara
Lara el 8 de Dic. de 2022
Hey, I am struggling to do the same. Have you found a solution?
Dmitrii
Dmitrii el 12 de Dic. de 2022
Hi Lara,
Unfortunately, no. I have ended up using another solution for my project.

Iniciar sesión para comentar.

Respuestas (1)

Ayush
Ayush el 8 de Sept. de 2023
I understand that you want a list of predecessors to search a node which you want using bfssearch.
As mentioned in the following documentation https://www.mathworks.com/help/releases/R2022b/matlab/ref/graph.bfsearch.html#buofmch-1-events you can use the events to get a table of all the data like "edgetonew" using the following command
[T,E] = bfsearch(G,s,"edgetonew")
Once you get the the table "T" and Edge indices "E" you can use those to find the predecessor.
Hope this helps!
Thank you.

Categorías

Más información sobre Graph and Network Algorithms en Help Center y File Exchange.

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by