⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 warshall.m

📁 Mathematical Methods by Moor n Stiling.
💻 M
字号:
function Anew = warshall(A)
% 
% Find the transitive closure of the graph represented by the adjacency
% matrix A
%
% function Anew = warshall(A)
%
% A = adjacency matrix of graph
% 
% Anew = adjacency matrix for transitive closure of graph

% Copyright 1999 by Todd K. Moon

[n,n] = size(A);
Anew = A;
for b=1:n
  for a=1:n
    if(Anew(a,b))                           % if we can get from a to b
      Anew(a,:) = max(Anew(b,:),Anew(a,:)); % then we can get from a 
                                            % to anywhere b gets to
    end
  end
end 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -