While relay coils are often used they come with an anoying surge that can potentially damage other components. After dropping the voltage across the inductor i.e. opening the relay, the coil instantly dissipates all his potential energy stored in his magnetic field. The switch at the diode is to show the difference between using a extinguisher diode and not. The switch at the voltagesource is used to trigger the relay i.e. on/off.