Target controllability of multiagent systems under fixed and switching topologies