📄 seek_fourcycle.m
字号:
function [cycle_position_all find_four]=seek_fourcycle(H,p)
% H=[1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0;
% 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0;
% 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0;
% 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0;
% 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1;
% 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0;
% 0 1 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1;
% 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0;
% 0 0 0 1 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0;
% 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0;
% 1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 1;
% 0 1 0 0 0 0 0 0 0 1 0 0 0 1 0 1 0 0 0 0;
% 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 1 0 0 0;
% 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0;
% 0 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0];
[m,n]=size(H);
%S=[0 0 0 0;0 4 1 2;0 2 3 1];
%p=5;
cycle_position_all=[];find_four=0;
for l=1:m-p
l;
h_r=H(l,:);
r_index=find(h_r);
L_r=length(r_index);
for i=1:L_r-1
i;
for j=i+1:L_r
j;
h_c=H(l+1:end,r_index(j));
c_index=find(h_c);
c_index=c_index+l;
L_c=length(c_index);
for k=1:L_c
k;
if H(c_index(k),r_index(i))==1
cycle_position=[l r_index(i);l r_index(j);c_index(k) r_index(j);c_index(k) r_index(i)];
cycle_position_all=[cycle_position_all cycle_position];
find_four=find_four+1;
end
end
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -