[关闭]
@Arbalest-Laevatain 2018-05-26T11:47:23.000000Z 字数 1058 阅读 1120

使用软件画有向图

MATLAB 离散数学 GVEdit


  1. close all,clear,clc;
  2. cm =[
  3. 0 10 0 18 0 0 0;
  4. 0 0 0 0 8 0 0;
  5. 25 0 0 0 0 9 0;
  6. 0 0 0 0 0 0 0;
  7. 0 0 13 0 0 0 0;
  8. 0 0 0 30 0 0 0;
  9. 0 0 0 0 15 12 0;
  10. ];
  11. IDS={'A','B','C','D','E','F','G'};
  12. bg=biograph(cm,IDS);
  13. set(bg.nodes,'shape','circle','color',[1,1,1],'lineColor',[0,0,0]);
  14. set(bg,'layoutType','radial');
  15. bg.showWeights='on';
  16. set(bg.nodes,'textColor',[0,0,0],'lineWidth',2,'fontsize',9);
  17. set(bg,'arrowSize',12,'edgeFontSize',9);
  18. get(bg.nodes,'position')
  19. dolayout(bg);
  20. bg.nodes(1).position=[100,200];
  21. bg.nodes(2).position=[50,100];
  22. bg.nodes(3).position=[100,100];
  23. bg.nodes(4).position=[150,100];
  24. bg.nodes(5).position=[0,0];
  25. bg.nodes(6).position=[200,0];
  26. bg.nodes(7).position=[100,0];
  27. dolayout(bg,'pathsonly',true);
  28. view(bg);

捕获.PNG-54.4kB

使用gvedit

  1. digraph G{
  2. size = "5, 5";//图片大小
  3. main[shape=box];/*形状*/
  4. main->main;
  5. parse->execute;
  6. main->init[style = dotted];//虚线
  7. main->cleanup;
  8. edge[color = green]; // 连接线的颜色
  9. execute->{make_string; printf}//连接两个
  10. init->make_string;
  11. main->printf[style=bold, label="100 times"];//线的 label
  12. make_string[label = "make a\nstring"]// \n, 这个node的label,注意和上一行的区别
  13. node[shape = box, style = filled, color = ".7.3 1.0"];//一个node的属性
  14. execute->compare;
  15. }

image_1cdcbuj4r393jss9oj4ght0d9.png-28.5kB

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注