Consensus and Synchronization in Complex Networks