i observe that you have posted two potentially related questions.
if they are in fact related, it may be of interest that the xml:demos;graphs;
directory of the cl-xml release contains a generator for graphviz dot files.
it is a simple demo, which generates a naive graph of the document instance or
the document definition, but could be easily be targeted to specific content.
...