I've done work on converting from graph form to text form. (Well, technically, I went from graph to a parse tree, but it's trivial to convert the parse tree into something with the syntax of "specimen 2".) Check out the working code at
Parsing 2D Graphs and
the Parse::RecDescent version. (Update: I just noticed you link to these indirectly through castaway's post.) It wasn't easy, but it handles choices and loops. The problem with it is that it expects valid data. Adding error checking is doable, but it would take time. Feel free to use any or all parts of it, and feel free to ask me any questions, given how poorly it is documented.