Connected components
Group towns that can reach one another by road. This shows which parts of the map still need a road to connect them.
Color every vertex reachable from one starting point. Pick a fresh color for each remaining unexplored island.
With adjacency lists, traversal takes O(V + E) time for V vertices and E edges.