function P = dgraf( A )
%计算图的可达矩阵
%A表示图的邻接矩阵
%P表示图的可达矩阵
n=size(A,1);
P=A;
%计算矩阵Bn
for i=2:n
P=P+A^i;
% P
end

P(P~=0)=1;
P;