Floyd Warshell Algorithm implementation