/*** Warshall Algorithm
* When calculating the proof transfer closure, you can see whether the graph has a path.
* Rij (k) = Rij (k) | Rik (k-1) & Rkj (k-1) ** O (n ^ 3) ** @ author chenxuegui **/public class Warshall {public static void main (String [] args) {boolean [] [] [] n = new boolean [] [] {false, true, false, false}, {false, true}, {false, false, false}, {true, false, true, false }}; warshall (n);}/***** @ param n */public static void warshall (boolean [] [] n) {for (int k = 0; k <n. length; K ++) {print (n); for (int I = 0; I <n. length; I ++) {// if n [I] [k] is false, then n [I] [j] is n [I] [j] if (n [I] [k]! = False) {for (int j = 0; j <n. length; j ++) {n [I] [j] = n [I] [j] | (n [I] [k] & n [k] [j]) ;}}} print (n);} public static void print (boolean [] [] n) {for (int I = 0; I <n. length; I ++) {for (int j = 0; j <n. length; j ++) {if (n [I] [j]) {System. out. print ("1");} else {System. out. print ("0") ;}} System. out. println ();} System. out. println ();}}