Dependency Graph Debian Packages

Creating a Dependency Graph for Debian Packages
The following will generate a complete dependency graph of all packages:

apt-cache dotty > dependency-graph.dot

To vizualise, you need the graphviz package:

dot -Tpng dependency-graph.dot

You will find that this does not work: the created graph is simply way to large to handle by GraphViz.

Visualize dependency packages of a single package
To visualize all dependencies that apache has, run:

apt-cache dotty apache2 > apache-dependency-graph.dot dot -Tpng apache-dependency-grap.dot

For details on the meaning of the different boxes, see the man page of apt-cache.

You will find this is still a large graph. Mostly, this is caused by all the "suggests" packages that are listed too. You can limit it to only the listed packages using the APT::Cache::GivenOnly option:

apt-cache -o APT::Cache::GivenOnly=1 dotty apache2 apache2-common apache2.2-common \ apache2-mpm-worker apache2-mpm-prefork apache2-mpm-event libapr1 libaprutil1 libc6 \ libdb4.4 libexpat1 libldap2 libpcre3 libpq4 libsqlite3-0 libuuid1 libcomerr2 libkrb53 \ libssl0.9.8 > apache-dependency-graph.dot

Visualize reverse dependencies
To visualize all reverse dependencies on Apache (thus list all packages that somehow depend on apache), you need the apt-rdepends package. apt-rdepends can both generate forward and reverse dependency graphs:

apt-rdepends -d apache2 > apache-dependency-graph.dot apt-rdepends -r -d apache2 > apache-rdependency-graph.dot