Graphs in LaTeX

Some time ago I was trying to figure out how to include graphs (the ones with vertices and edges) in LaTeX documents. I used to just use graphviz for this. graphviz ingests a textual description of a graph and outputs, for example, an EPS (Encapsulated PostScript) which can be included in a LaTeX document. Its graph description language is pretty flexible and it can do pretty much any graph layout.

Apparently, there is a LaTeX package dot2texi that lets us write graph definitions right inside a LaTeX document. It is based on graphviz and inherits its capabilities to lay out pretty complicated graphs. It has some additional features, though: we can write TeX formulas right inside graph nodes and edges.

I've also recently stumbled upon an excellent listings package. This package allows the inclusion of pretty-printed source code inside the documents. It supports the inclusion of external source files as well as the inclusion of inline code.