ruler-docs

Documentation for Ruler, the build tool

View on GitHub

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:

python make_chart.py
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.