Predicting and controlling complex networks