""" name: Nicholas Tamassia Honor Code and Acknowledgments: This work complies with the JMU Honor Code. Comments here on your code and submission. """ import pprint from collections import defaultdict from math import sqrt type Coordinate = tuple[float, float] type CoordMap = dict[int, Coordinate] type WeightedGraph = dict[int, dict[int, float]] def distance(a: Coordinate, b: Coordinate) -> float: x1, y1 = a x2, y2 = b return sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2) def create_graph(coords: CoordMap) -> WeightedGraph: graph: WeightedGraph = defaultdict(dict) coord_items = coords.items() for label1, coord1 in coord_items: for label2, coord2 in coord_items: if label1 == label2: continue weight = distance(coord1, coord2) graph[label1][label2] = weight graph[label2][label1] = weight return graph def calculate_cost(graph: WeightedGraph) -> float: cost: float = 0.0 return cost # All modules for CS 412 must include a main method that allows it # to imported and invoked from other python scripts def main(): n: int = int(input()) coords: CoordMap = {} for i in range(0, n): tokens = input().split() coords[i] = (float(tokens[0]), float(tokens[1])) weighted_graph = create_graph(coords) pprint.pprint(weighted_graph) # print(f"${cost:.1f}M") if __name__ == "__main__": main()