I am looking for a package that performs a reference tree on a document. For instance, if "Theorem x" is referenced via the
\ref
command in the proof of "Theorem y", then on the tree there should be an arrow from "Theorem x" to "Theorem y". Such a graph should hopefully not contain loops 
If you know anything like that, I'm interested.