Short- and long-term temporal network prediction based on network memory