What is a Dependence Graph?
A dependence graph is a diagram of files linked by arrows. Each arrow indicates a dependence between files, in other words: the file at the head of the arrow (called a target) must update whenever the file at the tail of the arrow (called a source) changes. Such a diagram comes in handy in many situations. Here is an example.
Suppose you are writing a scientific journal article. The finished article is a PDF, but that PDF is made by assembling text and visuals stored in other files. There are figures made in a drawing program, a chart showing experimental data, and a LaTeX file describing the final product.
The directory for this project contains:
- fig1.eps and fig2.eps Technical illustrations made by an artist
- data.csv A spreadsheet containing raw experimental data
- make_chart.py A script that reads
data.csvand uses a python library to construct chart.png run by typing:
python make_chart.py
- article.tex A LaTeX document containing the article’s text with formatting tags and references to the figures and to the chart all describing the final product
- article.pdf which we generate by typing:
pdflatex article.tex
This is the dependence graph:
If just one source file changes, following the arrows through the diagram reveals what must update. Suppose we add more experimental data to data.csv, this should prompt a change to chart.png, and that change must incorporate into article.pdf. So, we need to run:
python make_chart.py
pdflatex article.tex
On the other hand, if our artist makes adjustments to fig1.eps, then we must incorporate the new fig1.eps into the final pdf, but there’s no need to rebuild the chart. We only must to do this:
pdflatex article.tex
Throughout the Ruler documentation, we use diagrams like this one to quickly explain dependence scenarios and how Ruler handles them.