📄 prim.m
字号:
function [u,l]=prim(x,p)
%u is the set of the point serial
%l is the set of the length of sides serial
%x is adjacing matrix
%p is the set of all the point
u=[1];
l=[];
while length(p)~=0
lmin=inf;
%calculate the min length of side from u to p-u
p=setdiff(p,u);
lrem=0;
urem=0;
for ii=1:length(u)
for jj=1:length(p)
if lmin>x(u(ii),p(jj))
lmin=x(u(ii),p(jj));
lrem=lmin;
urem=p(jj);
end
end
end
u=[u urem];
l=[l lrem];
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -