Grap is a language for typesetting graphs specified and first implemented by Brian Kernighan and Jon Bentley at Bell Labs. It is an expressive language for describing graphs and incorporating them in typeset documents. It is implemented as a preprocessor to Kernigan's pic language for describing languages, so any system that can use pic can use grap. For sure, TeX and groff can use it.
For some reason, when James J. Clark implemented groff, a free version of troff and associated tools, he didn't implement grap. I finally wanted to use it badly enough that I wrote it. The current version is 1.49, released 16 Apr 2025. Details are in the CHANGES file and man pages.
This is probably worth upgrading to. I mishandled an undefined value, and that's never good.
The source is available, as well as some cool example output in gnuzipped postscript, pdf, or html.
If you have problems with grap, let me know.