connected_components.m
来自「The tca package is a Matlab program that」· M 代码 · 共 15 行
M
15 行
function [components,var_comp_matrix]=connected_components(G);
EG=expm(G);
N=length(G);
not_in_a_component=ones(1,N);
k=1;
while (k<=N)
ind=find(not_in_a_component);
if isempty(ind), break; end
var_comp_matrix(:,k)=(EG(:,ind(1))>0);
components{k}=find(var_comp_matrix(:,k));
not_in_a_component(components{k})=0;
k=k+1;
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?