Sayyiduna Ali bin al-Husayn (may Allah have mercy on him) narrates from his father, Sayyiduna al-Husayn (may Allah be pleased with him), that Sayyidah Fatimah (may Allah be pleased with her), the daughter of the Prophet (peace and blessings be upon him), used to visit the grave of her uncle Sayyiduna Hamzah (may Allah be pleased with him) every Friday, praying for forgiveness for him and shedding tears.
It has also been narrated (from Sulayman bin Dawud, from his father, from Ja'far bin Muhammad, from his father) without mentioning Ali bin al-Husayn from his father, and that is munqati' (broken chain).
It has been narrated from Sayyiduna Anas bin Malik (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) passed by a woman who was weeping at a grave, and he (peace and blessings be upon him) said to her: "Fear Allah and be patient." This report does not state that he (peace and blessings be upon him) forbade her from going out to the graveyard, and in this there is support for what was narrated in the hadith of Aishah (may Allah be pleased with her). However, the most authentic explicit report on this matter is the hadith of Sayyidah Umm Atiyyah (may Allah be pleased with her) and the reports that agree with it; so if women kept away from following funerals, going out to the graveyards and visiting graves, it would be safer for their religion.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الجنائز / 7208