My rule of thumb is this -
Take only historical pictures.
Which usually means old graves around 100 years old or older. My logic being that by that time any living relatives have pretty much never known the deceased, and they are in the "ancestors" category. Keep in mind this ONLY works in U.S. and Western European nations like ENgland and France. I know that some other countries feel differently about their ancestors. But once someone is an "ancestor" nobody usually minds taking pictures of the grave. Some people actually find PRIDE in it.
I also make sure I am very quiet, very careful and very discreet. The only time I ever got a weird look was in England where I was shooting 400 year old graves in front of a church. The wedding PHOTOGRAPHER was worried I was there to shoot the WEDDING.