Find minimum cost spanning tree on "n" cities, whose distance is calculated using Google Distance Matrix API.
- List of citites (file: "./inputs/cities.txt).
- List of pair of cities, whose edges has to be excluded to find spanning tree (file: "./inputs/remove.txt").
Input in "cities.txt" must be of format "indexNumber cityName" each on a new Line. Where indexNUmber starts from 0.
Input in "remove.txt" must be of format "cityA cityB", where both city names are seperated by a space.
- List of "n-1" edges forming minimum cost spanning tree.
- Cost of spanning tree.
-
Algorithm used: Kruskal algorithm to find minimum cost spanning tree.
-
"daaf.py": Used to geneate all possible edges and find the distance using Google Distance API between input cities, excluding edges given as input in "./inputs/remove.txt" file. To get your own Google API key: click here.
-
"edgesList.txt": Store edges and distance between 2 cities.
-
"kruskal.py": Calculate the minimum cost spanning tree generated and store result in "./output/output.txt"
- Kruskal algorithm: Click here
- Google API key Generation: Click here