Backport: (PUP-914) Use resource ref when writing dot files

Use the `ref` attribute of a resource instead of `to_s`.

Internally, Puppet uses the `ref` attribute to identify and locate resources
within a catalog. This patch makes use of `ref` to identify nodes in graphviz
output as some Types, notably Whit, override `to_s` and either destroy or
obscure the identity of resource nodes.