In the 50's, Roger Penrose invented a private graphical notation for tensors, which he later published. Wikipedia has a short description. It's basically a directed graph with some labels on it and some external edges. Predrag Cvitanovic has a modified version which is more amenable to typesetting, because he uses arrows rather than depending on "gravity" to give the direction of the edges, so it's easier to lay out as an inline or displayed equation. Penrose uses geometrical shapes for the nodes his diagrams, but I would be just as happy using letters. With Cvitanovic's convention I can do simple examples as inline tex math, e.g., \rightarrow\bigoplus\rightarrow\bigodot\leftarrow
, or \rightarrow u\rightarrow v\leftarrow
. (For the geometrical versions, it would be nice to have large squares, circles, and triangles, the size of \bigoplus
--- is there any way to produce these? Things like \nabla
seem too small.)
What would really be nice would be a way to typeset slightly more complex examples as latex math. Here are two examples using letters in the nodes:
Examples like the top one are clearly doable with symbols like \rightleftarrow
. I'm wondering if it's possible to get some of the fancier features such as the circle and loop in the second diagram, or the kinds of crossbars and wiggly crossbars shown in the WP article. The diagrams are somewhat related to Feynman diagrams, so it seems like maybe it could be done with one of the packages used for drawing those, but those seem more oriented toward drawing larger and more inescapably 2-D diagrams, and it's also not obvious to me which package is the best and most modern.
[EDIT] See also: https://mathoverflow.net/questions/25187/resources-for-graphical-languages-penrose-notation-feynman-diagrams-birdtra