Added a greedy approach in case Floyd Warshall algorithm is impractical