This work is concerned with asymptotic properties of consensus-type algorithms for networked systems whose topologies switch randomly. The regime-switching process is modeled as a discrete-time Markov chain with a nite state space. The consensus control is achieved by designing stochastic approximation algorithms. In the setup, the regime-switching process (the Markov chain) contains a rate parameter E > 0 in the transition probability matrix that characterizes how frequently the topology switches. On the other hand, the consensus control algorithm uses a step-size u that denes how fast the network states are updated. Depending on their relative values, three distinct scenarios emerge. Under suitable conditions, we show that when 0 < E = O(u), a continuous-time interpolation of the iterates converges weakly to a system of randomly switching ordinary dierential equations modulated by a continuous-time Markov chain. In this case, a scaled sequence of tracking errors converges to a system of switching diusion. When 0 < E << u, the network topology is almost non-switching during consensus control transient intervals, and hence the limit dynamic system is simply an autonomous dierential equation. When u << E, the Markov chain acts as a fast varying noise, and only its average is relevant, resulting in a limit dierential equation that is an average with respect to the stationary measure of the Markov chain. Simulation results are presented to demonstrate these findings. By introducing a post-iteration averaging algorithm, this dissertation demonstrates that asymptotic optimality can be achieved in convergence rates of stochastic approximation algorithms for consensus control with structural constraints. The algorithm involves two stages. The first stage is a coarse approximation obtained using a sequence of large stepsizes. Then the second stage provides a renement by averaging the iterates from the rst stage. We show that the new algorithm is asymptotically efficient and gives the optimal convergence rates in the sense of the best scaling factor and "smallest" possible asymptotic variance. Numerical results are presented to illustrate the performance of the algorithm.