problem in neighbors function

조회 수: 2 (최근 30일)
huda nawaf
huda nawaf 2022년 7월 27일
편집: huda nawaf 2022년 8월 2일
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

답변 (1개)

Steven Lord
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
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.
huda nawaf
huda nawaf 2022년 8월 2일
편집: huda nawaf 2022년 8월 2일
thanks @ steven
I installed trail ver. , and I run the code.
I created adjacancy mat. and call graph, then run code without any problem.
In fact the code is existing in a paper, it is working but the results are not satisfied.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품


릴리스

R2013a

Community Treasure Hunt

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

Start Hunting!

Translated by