code cleanup
refine floyd-warshall algorithm