1 - My limited knowledge of dogs from personal experience.
2 - Common sense.
3 - Simple research on the internet.
There are many versions of the story you posted about. At best, it was a stray dog that lived in the cemetery (with other stray dogs) that gravitated towards that gravesite for whatever reason to sleep.
Generally, people love a good story, and generally it's just that, a story.
Hachiko (sp?) I guess could be a somewhat credible story because the dog was already trained to wait for his master by the train tracks. Per your story, the dog had never been to the cemetery EVER, even after the dogs owner died.