problem in neighbors function
1 回表示 (過去 30 日間)
古いコメントを表示
hello,
This is my graph
G=[0 1 1 0 0 0;1 0 1 1 0 0; 1 0 0 1 1 0; 0 0 0 0 1 0; 0 0 0 0 0 1; 0 1 0 1 1 0];
when I apply the function neighbors
neighbors(G,active_nodes_last_round(individual));
where active_nodes_last_round(individual)=1;
I got the following error:
Undefined function 'neighbors' for input arguments of
type 'double'.
Error in IC_paper1 (line 26)
potential_infected=neighbors(G_duplicate,active_nodes_last_round(individual));
Thanks in advance
0 件のコメント
回答 (1 件)
Steven Lord
2022 年 7 月 27 日
The neighbors function, in this context, requires its first input to be a graph object not an adjacency matrix. Create a graph object from your adjacency matrix by calling graph and pass the resulting object into neighbors.
13 件のコメント
Steven Lord
2022 年 8 月 1 日
If you've purchased a license for the later releases you should have received instructions on how to download and install it in an email from Mathworks. Or you could go to the "Download Products" section on the Support section of the website, or you could click on the Get MATLAB button in the upper-right corner of this page.
参考
カテゴリ
Help Center および File Exchange で Graph and Network Algorithms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!