We consider the problem of data collection in a two-layer network consisting of (1) links between \(N\) distributed agents and a remote sink node; (2) a sparse network formed by these distributed agents. We study the effect of inter-agent communications on the overall energy consumption. Despite the sparse connections between agents, we provide an in-network coding scheme that reduces the overall energy consumption by a factor of \(\Theta(\log N)\) compared to a naive scheme which neglects inter-agent communications. By providing lower bounds on both the energy consumption and the sparseness (number of links) of the network, we show that are energy-optimal except for a factor of \(\Theta(\log\log N)\). The proposed scheme extends a previous work of Gallager on noisy broadcasting from a complete graph to a sparse graph, while bringing in new techniques from error control coding and noisy circuits.