Pseudocode:// B = nxn binary matrix// Bm = resulting matrixfor (i=1; i<=n; i++){  for (j=1; j<=n; j++)  {    if (B[i,j] == 1)    {      for (k=1; k<=n; k++)      {        Bm[i,j] = B[i,j] | B[k,j];      }    }  }}This is the Warshall algorithm written (in my way):B = [1 1 0 0 0; 0 0 0 1 0; 0 0 0 0 1; 0 1 0 0 0; 0 0 0 0 0];n = 5;Bm = zeros(n);for i = 1:n    for j = 1:n        if B(i,j) == 1            for k = 1:n                Bm(i,k) = B(i,k) | B(k,j);            end        end    endendIt works but, how can I improve the matrix loops?
Getting B+ matrix (Warshall algorithm) in Matlab
algorithm;matrix;matlab