Networks of interacting systems with heterogeneous degrees and community structures are ubiquitously found in natural and artificial systems such as, among others, neuronal networks, gene-regulatory networks, and power grids. Recovering the characteristics of the networks and of the dynamics from observations of the systems is a crucial problem that has attracted a lot of attention. In this talk, I will present an approach to reconstruct the statistical properties of the connectivity structure of the network when the interaction strength between units is weak and the isolated dynamics of the nodes is chaotic. With relatively short time-series, our method can recover the degree distribution, the community structures, and build a model for the isolated dynamics and the interactions. The approach combines machine learning techniques with recent results on the ergodic theory of high-dimensional coupled systems. The procedure is able to accurately reconstruct the characteristic of simulated dynamics when tested on Scale-Free networks and graphs presenting Rich-Club motifs. We then used the results to predict the transitions to collective behaviour of the system from a single multivariate timeseries, observed in a state far from the transition.