Exploiting the Agent's Memory in Asymptotic and Finite-time Consensus over Multi-agent Networks