Question: why diode across relay coil?
Answer: A flyback diode or freewheeling diode is placed with reverse polarity from the power supply and in parallel to the relay's inductance coil. The use of a diode in a relay circuit prevents huge voltage spikes from arising when the power supply is disconnected.