Please give me reference of the hadith which says that in the days of the Prophet (sws), women were initially stopped from visiting the graves because they used to vociferously wail. Once the women had learned to restrain themselves at such places, they were allowed to visit the graveyards.
The following discussion from Fiqhus Sunnah of Syed Sabiq covers the entire material you need:
Imam Malik and some Hanafi scholars, and, according to one report from Ahmad, most of the scholars hold it permissible for women to visit graves. This is based on the following hadith from ‘Aishah, “What should I say to them, O Messenger of Allah when visiting graves?
“As mentioned above Abdullah Ibn Abi Mulaykah is also reported to have said, “Once ‘Aishah returned after visiting the graveyard. I asked, ‘O Mother of the Believers, where have you been?
She said: ‘I went out to visit the grave of my brother Abd ar-Rahman.’ I asked her: ‘Didn’t the Messenger of Allah, peace be upon him, prohibit visiting graves?’ She said,
‘Yes, he did forbid visiting graves during the early days, but later on he ordered us to visit them’.” This is reported by Al-Hakim and Al- Baihaqi, who also remarked that this hadith was narrated only by Bistam bin Muslim al-Basri. Dhahabi said that it is a sound hadith