Answer
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
Eid is a time of celebration and joy. So, if by visiting the graves one would not be able to be true to the spirit of celebration it may be better to avoid it;
In responding to your question, Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
Visiting the graves is a Sunnah of the Prophet (peace be upon him). He said, “Earlier, I had forbidden you from visiting graves; now you can do it for it may remind you of the Hereafter.” (Muslim)
The Prophet further said, “The deceased would know who visit them; they will return the greeting of those who greet them.”
Having said this, I should point out that Eid is a time of celebration and joy. So, if by visiting the graves one would not be able to be true to the spirit of celebration it may be better to avoid it. If that is not the case, and by visiting the deceased, he is merely remembering them on the occasion of their joy that is fine. In that case, it would be even better.
However, at all times, one must shun all forms of wailing and lamentations. If there is a fear of indulging in them, then one should avoid such visits altogether.
Almighty Allah knows best.