Read the problem statement. Note that the graph is implicit: you are not given edges. You need to generate all possible edges from the points. The cost between points and is .
With points, you have edges total. That is a lot of edges for large inputs. Think about whether you need to generate all edges upfront or compute them on demand. This decision affects both time and space.