필터 지우기
필터 지우기

How to add nodes and edges?

조회 수: 3 (최근 30일)
Aswin Sandirakumaran
Aswin Sandirakumaran 2018년 6월 9일
댓글: Walter Roberson 2018년 6월 9일
p = [3,2,1];
for i = 1:length(p)
last_element = p(end);
G = graph();
H = addnode(G,last_element);
*HOW TO ADD EDGE??? HERE ??*
p(end) = []; % REMOVING THE LAST ELEMENT ONCE ADDED TO THE GRAPH so in 2nd iteration p = [3,2]
end
plot(H);

채택된 답변

Walter Roberson
Walter Roberson 2018년 6월 9일
You can use addedge() to add edges.
  댓글 수: 2
Aswin Sandirakumaran
Aswin Sandirakumaran 2018년 6월 9일
I know that, what wil be the parameters??
Walter Roberson
Walter Roberson 2018년 6월 9일
The first parameter would be G.
We do not know what the other parameters would be, as you have not given us any information about which nodes are to be connected by the edge.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by