On the Control of Consensus Networks: Theory and Applications