赞
踩
% 首先在matlab中把图画出来
s = [1 2 2 3 3 3 4 4 5];
t = [2 5 4 3 1 2 3 5 2];
G = digraph(s,t)
p = plot(G);
[cycles,edgecycles] = allcycles(G);
p = plot(G);
highlight(p,'Edges',edgecycles{1},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6)
p = plot(G);
highlight(p,'Edges',edgecycles{2},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6)
p = plot(G);
highlight(p,'Edges',edgecycles{3},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6)
p = plot(G);
highlight(p,'Edges',edgecycles{4},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6)
p = plot(G);
highlight(p,'Edges',edgecycles{5},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6)
第一个圈
第二个圈
第三个圈
第四个圈
第五个圈
% 首先在matlab中把图画出来 s = [1 2 2 3 3 3 4 4 5]; t = [2 5 4 3 1 2 3 5 2]; G = digraph(s,t) p = plot(G); [cycles,edgecycles] = allcycles(G); p = plot(G); highlight(p,'Edges',edgecycles{1},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6) p = plot(G); highlight(p,'Edges',edgecycles{2},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6) p = plot(G); highlight(p,'Edges',edgecycles{3},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6) p = plot(G); highlight(p,'Edges',edgecycles{4},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6) p = plot(G); highlight(p,'Edges',edgecycles{5},'EdgeColor','r','LineWidth',1.5,'NodeColor','r','MarkerSize',6)
谢谢大家的观看,这题不难,15min搞定。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。