This Halacha is an excerpt from our Sefer, “The laws and customs of mourning” volume 2 chapter 31, available for purchase on Amazon.com
The accustomed dates for visiting the grave of a deceased relative:
It is customary to visit the grave of the deceased on certain dates throughout the first year of mourning, and in future years, on the day of the Yahrzeit. During the first year, some avoid visiting the grave on days other than the dates brought below, in order not to burden the soul of the deceased, as explained in C. After the first year, there are no restrictions, and one may visit the grave whenever he desires, so long as it is not on a day that graves are not visited, as explained in Halacha 3. Nonetheless, one is not to over increase on the visitation of graves and is not to go unnecessarily. The following are the details of this matter.
Some are accustomed to go to the cemetery and visit the grave of the deceased on the seventh day of Shiva, after the Aveilim get up from Shiva after Shacharis. Others are not accustomed to visit the cemetery on the seventh day.
Seventh days falls on day that we do not visit graves [i.e. Shabbos]: If the seventh day falls on Shabbos or Rosh Chodesh, one is not to go that day and is rather to go the day after. If Yom Tov falls during the Shiva, some say to visit the Kever on Isru Chag while others say to visit only after seven days have passed from burial. See Halacha 3!
May one visit the grave during Shiva?
One is not to visit the grave during Shiva, until the end of Shiva. This applies for both relatives and non-relatives.
B. Eighth day by Hakamas Matzeiva:
Various customs exist regarding when the Matzeiva is to be erected as explained in Chapter 30 Halacha 7. Some follow that it is to be done immediately after the completion of Shiva, and so is the Chabad custom to erect the Matzeiva on the 8th day after the burial, which is the day after Shiva. Whatever the case, there is no obligation for family members to be present by the establishing of the Matzeiva ceremony, and in previous times it was actually rare to have family present. Nonetheless, today it is common practice for the family to visit the grave in honor of the establishing of the Matzeiva.
Some communities are accustomed to go to the cemetery and visit the grave of the deceased on the day of Shloshim. [Others, however, are not accustomed to visit the cemetery at the end of the Shloshim.]
Shloshim falls on day that we do not visit graves [i.e. Shabbos]: See Halacha 3!
Coming up in Part 2:
 See Pnei Baruch 37; Nitei Gavriel Volume 2 80-84
 See Tur 344 in name of Kol Bo “And one visits him on the day of the Shloshim, and no longer”; Mishmeres Shalom Hei 26; Gesher Hachaim 29:2; Maharam Brisk 2:29; See Nitei Gavriel 81 footnote 3 and 10 based on Zohar that during the first year the soul knows of his own suffering and cannot be bothered with suffering of others; See Nitei Gavriel 81:4-7 for all the opinions on this matter!; See Igros Kodesh 4:173; 9:301
 See M”A 559:11 in name of Arizal that one should only go for the Levayah, especially if one is a Baal Keri, implying that one should avoid visiting graves. Seemingly, however, this excludes the graves of Tzadikim, and perhaps even that of close relatives, although from it we can learn that it is discouraged to visit graves unnecessarily. [See Minchas Elazar 1:68; Toras Chaim Sofer 581:12; Nitei Gavriel 82:9]
 M”A 696:5 in name of Maharash Levi 13:25; Michaber 344:20 based on Tur and Rav Haiy Gaon regarding a Chacham, Aluf, Vegaon, and some are accustomed to do so for all deceased relatives as brought in M”A ibid; Poskim brought in Nitei Gavriel 136:17 footnote 25; Volume 2 81:2
 Aruch Hashulchan 344:12 that this Minhag is no longer practiced today
 Kol Bo brought in Beir Hagoleh Yoreh Deah 344:20 [regarding Rosh Chodesh even if falls on seventh of Shiva] Shaar Hayichudim of Arizal p. 5 [the souls are not by the graves]; Alef Hamagen 581:110; Mishmeres Shalom 5:129
 Gesher Hachaim; Nitei Gavriel 136:19
 See Nitei Gavriel 136:20
 Implication of Arizal in Taamei Hamitzvos Parshas Vayechi; Directive of Minchas Yitzchak; Nitei Gavriel 81:1
 Toras Menachem 1988 2:635; Igros Kodesh 23:411 [brought in Shulchan Menachem 5:283]
 See Nitei Gavriel 67:3; Orchos Rabbeinu in name of Steipler and Rav Chaim Kanievsky that doing so was never a Jewish custom, and it was taken from the gentiles.
 Michaber 344:20 based on Tur and Rav Haiy Gaon regarding a Chacham, Aluf, Vegaon, and some are accustomed to do so for all deceased relatives; Ramban; Rokeiach 316; Mavor Yabok; Nitei Gavriel Vol. 2 37:3; 81:4
 Aruch Hashulchan 344:12 that this Minhag is no longer practiced today; Kinyan Torah 119; Nitei Gavriel Vol. 2 81:4