I want to do the following:

Supose you have a written document, with sections, subsections, subsubsections, figures, equations, bibliography, etc. With reference among themselves.

I would like to create "in an automatic way", a graph diagram that express the relations (references) in between all the elements of the document.

I know I can use TiKz to create the graph. My question is how could I can obtain the information off all the objects and their references to draw this graph.

This document is an example of what I would like to achieve example

Thank you !