# Examples of MathJax codes of directed labelled graphs to use in a MathOverflow Question

I need some examples of MathJax codes of directed labelled (with loops or multiple edges) graphs to use in MathOverflow Questions so that I could easily change them to my graphs.

Here is my try to write such a graph, but I do not know how I can merge these lines to one graph:

$1 \overset{x}{\longrightarrow} 2 \overset{x}{\longrightarrow} 3 \overset{x}{\longrightarrow} 4 \overset{x}{\longrightarrow} 1$

$4 \overset{y}{\longrightarrow} 5 \overset{x}{\longleftarrow} 6 \overset{x}{\longleftarrow} 7 \overset{y}{\longleftarrow} 2 \overset{x}{\longleftarrow} 1 \overset{x}{\longleftarrow} 4$

$2 \overset{y}{\longrightarrow} 8 \overset{y}{\longrightarrow} 9 \overset{x}{\longrightarrow} 10 \overset{y}{\longleftarrow} 11 \overset{y}{\longleftarrow} 3 \overset{x}{\longleftarrow} 2$

$3 \overset{x}{\longrightarrow} 4 \overset{y}{\longrightarrow} 5 \overset{x}{\longleftarrow} 6 \overset{y}{\longrightarrow} 14 \overset{x}{\longleftarrow} 13 \overset{y}{\longrightarrow} 12 \overset{x}{\longrightarrow} 11 \overset{y}{\longleftarrow} 3$

Here is one possible way to draw your diagram. The AMScd package doesn't seem to support longer arrows, so 7 has to make quite an detour. $\require{AMScd}$

\begin{CD} 7 @= 7 @= 7 @= 7\\ @| @. @. @AyAA\\ 7 @. @. 1 @>x>> 2 @>y>>8\\ @VxVV @. @AxAA @VxVV @VyVV\\ 6 @>x>> 5 @<y<< 4 @<x<< 3 @. 9\\ @VyVV @. @. @VyVV @VxVV\\ 14 @<x<< 13 @>y>> 12 @>x>> 11 @>y>> 10 \end{CD}

For a guide to drawing these, see this MSE meta answer. To see the source code, right click over the diagram and choose "Show Math As" > "TeX Commands" or click the edit button to see the source of the whole post.

Edit: Here is another version of the diagram with "fake" long arrows but without the equal signs. Long arrows produced this way look silly enough as is, so I didn't want to make them with corners.

\begin{CD} 14 @<y<< 6 @<x<< - @<<< 7\\ @AAA @VVV @. @AyAA\\ | @. | @. 1 @>x>> 2 @>y>>8\\ @AxAA @VxVV @AxAA @VxVV @VyVV\\ | @. 5 @<y<< 4 @<x<< 3 @. 9\\ @AAA @. @. @VyVV @VxVV\\ 13 @>>> - @>y>> 12 @>x>> 11 @>y>> 10 \end{CD}

• Can't you do two diagonal arrows to the instance of 7 just above 1? Or is that the point of the question? Gerhard "Likes Getting To The Point" Paseman, 2015.07.15 Jul 15, 2015 at 21:49
• @GerhardPaseman, unfortunately the package does not support diagonal arrows. These diagrams are easy to write and require no external tools, but they don't bend as far as one would hope. (There might be a more clever way of building the same diagram, but I doubt there is a solution with only arrows with this tool.) Jul 15, 2015 at 21:57
• OK. While the equal signs are suggestive, I would replace them with undecorated arrows, get rid of the excess 7's, and decorate two of the arrows. Gerhard "Less Ink Is Better Ink" Paseman, 2015.07.15 Jul 15, 2015 at 22:20
• @GerhardPaseman, I added another way to produce the diagram, now without any repeated numbers. The long arrows are not very pretty, but it looks prettier in a way without the equal signs. Jul 16, 2015 at 9:46