Recognize this as a classic Minimum Spanning Tree (MST) problem where we need to connect all nodes in a graph with the minimum total weight.
Use Kruskal's Algorithm because the input is provided as an edge list, making it natural to sort by weight and process edges greedily.
Employ a Disjoint Set Union (DSU) data structure with path compression and union-by-rank to efficiently track connected components and avoid cycles.
Verify connectivity: If the total number of edges successfully added to the MST is exactly n - 1, all cities are connected; otherwise, the graph is disconnected, and we return -1.