MATLAB using undocumented search call

1 回表示 (過去 30 日間)
Anthony Ramirez
Anthony Ramirez 2021 年 6 月 17 日
コメント済み: Christine Tobler 2021 年 6 月 17 日
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 件のコメント
Christine Tobler
Christine Tobler 2021 年 6 月 17 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by