Add and remove node from graph

조회 수: 6 (최근 30일)
mh fr
mh fr 2020년 5월 3일
편집: Walter Roberson 2024년 12월 5일
how can i add removed nodes of a specific graph??
forr example i removed all nodes of graph G by degree in code below. now i wanna add all nodes to graph by degree. i have problem by adding nodes.
A=adjacency matrix
G =graph(A);
D=degree(G);
for j=1:length(D)
D=degree(G);
[M,I] = max(D);
G = rmnode(G,I);
end

답변 (1개)

BhaTTa
BhaTTa 2024년 12월 5일
Hey @mh fr, To add back the removed nodes to a graph in MATLAB, you can follow these steps:
  1. Store the Removed Nodes: Keep track of the nodes you're removing so you can add them back later.
  2. Recreate the Graph: After removing all nodes, you can add them back in the same order.
Hope it helps.

카테고리

Help CenterFile Exchange에서 Networks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by