Answer
(Fatwa: 1158/1158=M/1429)
It is written in books that visiting graveyard on Eid day is mustahab (desirable). One should visit graves now and then at other occasions as well. In some nights, especially the Night of Bara?ah it is proved that the Prophet (صلی اللہ علیہ وسلم) visited graves. One can pray for the dead from his home as well and that prayer is acceptable before Allah, but by visiting graves one is reminded of the world hereafter and death, therefore it is better to visit them.
Allah (Subhana Wa Ta’ala) knows Best
Darul Ifta,
Darul Uloom Deoband