In order to unveil the value of network connectivity, discounted both in space and time, we formalize the construction of networks as an optimal control dynamic graph-theoretic problem. The network is based on a set of leaders and followers linked through edges. The node dynamics, built upon the consensus protocol, form a time evolutive Mahalanobis distance weighted by the opportunity costs. The results show that the network equilibrium depends on the influence of leader nodes, while the network connectivity depends on the cohesiveness among followers. Through numerical simulations, we find that - past a threshold level of opportunity costs - the values of shadow prices become stationary. Likewise, the model outputs show that, at a fixed level of foregone gains, agents value the safeguard of connections less in time than in space.