  We study the equilibrium states of energy functions involving a large set of
real variables, defined on the links of sparsely connected networks, and
interacting at the network nodes, using the cavity and replica methods. When
applied to the representative problem of network resource allocation, an
efficient distributed algorithm is devised, with simulations showing full
agreement with theory. Scaling properties with the network connectivity and the
resource availability are found.
