Traditionally in a (control) engineering sense, what you're asking for is a block diagram. Block diagrams are convenient way to capture relationships that depend on prior state (typically a summation or integration in a discrete or continuous sense). This method is pretty extensive in scope and I'm sure it encompasses what you want.
Although graphviz could do this, you're looking for a higher degree of layout control than what you typically get with the graphviz tools. There are engineering tools like simulink for solving this problem, but they tend to be excessive if you already have the code. Perhaps a better option is to generate LaTeX / TiKZ code, and generate PDFs from there. This ensures you get (academic) publication quality diagrams. There are great packages for doing this already.