📄 plot_mst.m
字号:
function plot_mst(a,tree,c,lwidth)%PLOT_MST Plot minimum spanning tree%% PLOT_MST(A,TREE,STR,LWIDTH)% % Plots the edges of a minimum spanning tree, defined by the nodes A and% TREE% % INPUT% A dataset% TREE list of edges% STR color e.g. 'k','m' or [0.9 0.1 0.7]% LWIDTH linewidth%% See also: mst_dd, datasets, mappings% Copyright: Piotr Juszczak, p.juszczak@tudelft.nl% Information and Communication Theory Group,% Faculty of Electrical Engineering, Mathematics and Computer Science, % Delft University of Technology, % The Netherlandsif (nargin<2), error('At least 2 inputs expected');endif (nargin==2),lwidth=1;c='k';end[m,k] = size(a);mt = size(tree);if ((m-1)~=mt), error('The size of dataset does not much number of edges.'); endi=0;if ~ishold, hold on; i=1; endfor k=1:size(tree,1) plot([+a(tree(k,1),1),+a(tree(k,2),1)],[+a(tree(k,1),2),+a(tree(k,2),2)],... 'linestyle','-','linewidth',lwidth,'color',c);endif i==1, hold off; endreturn;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -