필터 지우기
필터 지우기

how to dynamically assign node label in a graph

조회 수: 1 (최근 30일)
Li Xue
Li Xue 2017년 7월 14일
답변: Steven Lord 2017년 7월 14일
I have a graph:
s={'A','B'};
t={'C','D'};
G=graph(s,t);
Each node also has a feature vector:
key={'A','B','C','D'};
value = {[1 2], [3 4], [5 6], [7 8]};
feature = cell2struct(value,key,2);
How can I add the feature to each node of the graph?

답변 (1개)

Steven Lord
Steven Lord 2017년 7월 14일
See the "Add Custom Attributes" section of this documentation page to add additional information to the graph object. If you want to use those custom attributes when plotting the graph see the "Label Nodes and Edges of Graph Plot" section on that page.

카테고리

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