  For a functional defined on the class of closed one-dimensional connected
subsets of ${\mathbb R}^n$ we consider the corresponding minimization problem
and we give suitable first order necessary conditions of optimality. The cases
studied here are the average distance functional arising in the mass
transportation theory, and the energy related to an elliptic PDE.
