MATLAB using undocumented search call

1 vue (au cours des 30 derniers jours)
Anthony Ramirez
Anthony Ramirez le 17 Juin 2021
Commenté : Christine Tobler le 17 Juin 2021
Hello,
I am currently working on a research project; one part of it involves paths for tree graphs. Basically I want to input a tree graph and a starting vertex and get back the entire traversal path something such as what dfsearch performs but preserving all the vertices it visited (it is okay to visit vertices multiple times and technically we must visit each edge twice for my problem). I found that dfsearch performs basically what I am looking for except it (obviously) only gives back the distinct vertex visit order. When trying to understand better how MATLAB dfsearch works, so that I could modify it myself for criteria I need, I found that it was a basic one-line that used the function "search()". However, MATLAB has no documentation (that I could find) on this call and when using it in another .m file, MATLAB threw "Error using graph/search. Cannot access method 'search' in class 'graph'. " at me.
MATLAB Code:
function [t, eidx] = dfsearch(G, s, varargin)
if nargout <= 1
t = search(false, G, s, varargin{:});
else
[t, eidx] = search(false, G, s, varargin{:});
end
Could anyone help either point me in a direction that explains how to understand this search() call and possibly how to use it?
  1 commentaire
Christine Tobler
Christine Tobler le 17 Juin 2021
That search is a private method of graph, you can find it in @graph/private/search. However, this then calls a built-in, so it won't be that helpful in showing the iteration through the graph's nodes.
I don't see a way to modify the outputs from the builtin function to provide your additional outputs, so it might be best to implement the Depth-First Search directly in MATLAB code.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Graph and Network Algorithms dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by