In this paper, we discuss the relationship between consensus on node voltage in electric networks and consensus on node value in graphs. According to the topology of a graph, we construct two kinds of networks: an RC network and an RLC network, corresponding to single-integrator dynamics and double-integrator dynamics respectively. Then we investigate three classic problems: leader following, consensus tracking, formation maintaining using RC networks and discuss consensus of networks with switching topology. An upper bound of convergence speed was given in view of energy, and we found that the energy decrease of average consensus is proportional to the variance of the initial voltages of capacitors. The energy analysis in electric networks is similar to the Lyapunov function. Simulations are provided at last to demonstrate the theoretical results.