Basic python implementation of APSP