Praise be to Allah.
If someone dies in the state which you describe, it is not permissible to walk in their funeral procession, or to pray over him, or to make du’aa’ and seek forgiveness for him, or to perform Hajj on his behalf or give charity on his behalf – because the actions mentioned (sacrificing at graves, etc.) are actions of Shirk, and Allaah has said, in the Soorah quoted above (interpretation of the meaning):
“It is not (proper) for the Prophet and those who believe to ask Allaah’s forgiveness for the Mushrikoon, even though they be of kin” [al-Tawbah 9:113].
And it was reported that the Prophet (peace and blessings of Allaah be upon him) said: “I asked my Lord for permission to pray for forgiveness for my mother, and He did not grant me permission. Then I asked Him for permission to visit her grave, and He granted me permission.”
(Narrated by Ahmad, 2/441, 5/355, 359; Muslim, 2/671, no. 976; Abu Dawood, 3/557, no. 3234; al-Nasaa’i, 4/90, no. 2034; Ibn Maajah, 1/501, no. 1572; Ibn Abi Shaybah, 3/343; Ibn Hibbaan, 7/440, no. 3169; al-Haakim, 1/375-376, 376; al-Bayhaqi, 4/76).
They cannot be excused by saying that no one came to them who could explain that the things which they did were shirk, because the evidence to that effect in the Qur’aan is very clear, and there are knowledgeable people among them whom they could have asked about whether what they were doing was shirk – but they turned away and were content with what they were doing.
And Allaah is the Source of strength. May Allaah bless our Prophet Muhammad and his family and companions, and grant them peace.