如何用matlab画出有向图(带箭头)

close all,clear,clc;

cm =[ 

     0     10     0     18     0     0     0;

     0     0      0     0      8     0     0;

     25    0      0     0      0     9     0;

     0     0      0     0      0     0     0;

     0     0      13    0      0     0     0;

     0     0      0     30     0     0     0;

     0     0      0     0      15    12    0;

     ];

 IDS={'A','B','C','D','E','F','G'};

 bg=biograph(cm,IDS);

 set(bg.nodes,'shape','circle','color',[1,1,1],'lineColor',[0,0,0]);

 set(bg,'layoutType','radial');

 bg.showWeights='on';

 set(bg.nodes,'textColor',[0,0,0],'lineWidth',2,'fontsize',9);

 set(bg,'arrowSize',12,'edgeFontSize',9);

 get(bg.nodes,'position')

 view(bg);

 help biograph

猜你喜欢

转载自blog.csdn.net/wangh0802/article/details/82312670