Convex relaxation and variational approximation of functionals defined on 1-dimensional connected sets