Consensus in a Multi-Agent System with Switching Topology