資源簡介
Matlab根據鄰接矩陣求最大連通分支,返回最大連通分支集合。
之前上傳的一版有小錯誤,此版已修改。
代碼片段和文件信息
function?[?MaxConnComp?]?=?Online_Max_connected_component(?AdjacentMatrix?)
%ONLINE_MAX_CONNECTED_COMPONENT?Summary?of?this?function?goes?here
%???For?non-directional?graph
[K~]=size(AdjacentMatrix);
VerticesTag=zeros(1K);
TagNum=1;
for?Iter1=1:K
????for?Iter2=Iter1+1:K
????????if?AdjacentMatrix(Iter1Iter2)==1
????????????if?(VerticesTag(Iter1)==0)&&(VerticesTag(Iter2)==0)
????????????????VerticesTag(Iter1)=TagNum;
????????????????VerticesTag(Iter2)=TagNum;
????????????????TagNum=TagNum+1;
????????????else
????????????????if?(VerticesTag(Iter1)~=0)&&(VerticesTag(Iter2)~=0)
????????????????????IndexTemp=find(Vertic
- 上一篇:Caffe Matlab直接運行配置
- 下一篇:matlab實現男女聲互變
評論
共有 條評論