Population density and commerce

Is there an optimal level of population density with regards to commerce?

A rural area is likely too low. Talent is far away, there aren’t many organizations located near each other. The network effects aren’t there.

But on the other hand, New York City seems inefficient because there’s so much congestion and everything is more expensive. Or is it appropriately priced and everywhere else is cheap?

I think there’s a graph of commerce optimality and population density. What is the shape of the graph? It’s possible we’re already past the ideal point, but it’s also possible we have a long way to go.

What does the graph look like and how far along are we?