You said that you could write the code for the general recipe given answers to the three specific questions. However, if you want general recipes, TikZ's graph-drawing facilities, especially the various algorithms available, must surely be the way to go.
I do not know this very well - it feels like alien territory - but LuaTeX provides a good deal of power and the documentation and libraries are extensive. If you'll be drawing lots of them, it will be worth your while to invest the time in reading the documentation in the manual.
circular
, routing
, graphs.standard
(for standard graphs such as K_n
etc.) should be of particular interest. Note the introduction is in the main bit of the manual and the detail is in the graphs drawing part proper.
Here's a mini-example based on your stated desiderata. (I'm not very clear what these are, so this really means your stated desiderata as best I could fathom them.)
\RequirePackage{luatex85}
\documentclass[border=10pt,multi,tikz]{standalone}
\usetikzlibrary{graphs,graphdrawing,arrows.meta,quotes}
\usegdlibrary{circular}
\begin{document}
\tikz[>=Stealth]{%
\graph [simple necklace layout, grow'=down, node sep=20mm, nodes=draw, edge quotes center, edge quotes={fill=white, inner sep=1pt, font=\scriptsize}]
{
6 ->[bend left, "a"] {5, 4, 3, 2, 1};
5 ->[bend left, "b"] {6, 4, 3, 2, 1};
4 ->[bend left, "c"] {6, 5, 3, 2, 1};
3 ->[bend left, "d"] {6, 4, 5, 2, 1};
2 ->[bend left, "e"] {6, 4, 3, 5, 1};
1 ->[bend left, "f"] {6, 4, 3, 2, 5};
};
}
\end{document}
Obviously, you'd need to create the edges individually if you needed different labels each time - or create a loop, but that would not really be worth it in that case. The subgraph
is laying out the nodes.
You could also use e.g. subgraph C_n [n=6, ->]
, perhaps with necklace routing
(libraries: graphs.standard
, routing
). It really depends on the details of what you are trying to do ...
EDIT
Note that I just provided an example of what's possible. If you use this, obviously you will want to look at the documentation to tweak it to your requirements.
Here are 3 examples using the standard graph drawing elements. A simple counter is used for labelling the edges which is reset between graphs. Use the edge counter
style in the argument to edges
for the part of the graph where you want paths to be labelled.
\RequirePackage{luatex85}
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{graphs,graphs.standard,graphdrawing,arrows.meta,quotes}
\usegdlibrary{circular}
\begin{document}
\newcounter{countme}
\setcounter{countme}{0}
\newcommand*\countup{\stepcounter{countme}\thecountme}
\newcommand*\countset{\setcounter{countme}{0}}
\tikzset{%
edge counter/.style={"\countup"},
}
\tikz[>=Stealth]{%
\graph [simple necklace layout, grow'=down, node sep=20mm, nodes=draw, edge quotes center, edge quotes={fill=white, inner sep=1pt, font=\scriptsize}]
{
subgraph C_n [n=6, -!-];
{ [edges={edge counter, bend left}]
6 -> 5 ->[loop below] 5 -> 2 -> 6 -> 3;
}
};
}
\countset
\tikz[>=Stealth]{%
\graph [simple necklace layout, grow'=down, node sep=20mm, nodes=draw, edge quotes center, edge quotes={fill=white, inner sep=1pt, font=\scriptsize}]
{
subgraph C_n [n=6, -!-];
{ [edges={edge counter, bend left}]
3 -> 4 ->3 -> 1 -> 2 -> 3;
};
};
}
\countset
\tikz[>=Stealth]{%
\graph [simple necklace layout, grow'=down, node sep=20mm, nodes=draw, edge quotes center, edge quotes={fill=white, inner sep=1pt, font=\scriptsize}]
{
subgraph C_n [n=6, -!-];
{ [edges={edge counter, bend right, blue}]
1 -> {2, 3, 4} -> 5;
}
};
}
\end{document}
Note that older installations of TeX will not have luatex85
. If your system doesn't have it, just leave it out and it should work fine.
bend left
andbend right
, so you already have the answer to (1) right there. This should also solve (2). For (3), if you load thequotes
library, you can use"<label>"
to add the labels andevery edge label
to style and position them.document
environment. Please edit your question to provide a minimal working example people can compile.auto
. Otherwise your question is not very clear to me. Do you looking for something to similar to tex.stackexchange.com/questions/281031/… ?