Convergence Rate of Distributed Averaging Dynamics and Optimization in Networks (Foundations and Trends in Systems and Control)