# How can I make this graph look better?

Here's what my graph looks like:

I have several issues with this:

1. I expected the external edges to have similar sizes. As you can see, the ones on the sides are much longer than the ones on the top/bottom. Is there a way to make them even, and the graph look more "circular"?
2. The nodes are of different sizes. The one in the middle is way too big. Is there a way to make them the same size (possibly make all the labels smaller, so that the nodes aren't really big)?
3. The labels on the edges are placed almost randomly. Is there a way to make this more consistent?

My code:

\begin{tikzpicture}[->,node distance=3cm,auto,
main node/.style={circle,draw}]

\node[main node] (0) {$$f1, f2, f3$$};
\node[main node] (1) [above of=0] {$$f1, f2$$};
\node[main node] (2) [above right of=0] {$$f2$$};
\node[main node] (3) [below right of=0] {$$f2, f3$$};
\node[main node] (4) [below of=0] {$$f3$$};
\node[main node] (5) [below left of=0] {$$f1, f3$$};
\node[main node] (6) [above left of=0] {$$f1$$};

\path[every node/.style={font=\sffamily\small}]
(0) edge node {$$f3$$} (1)
(0) edge node {$$f1$$} (3)
(0) edge node {$$f2$$} (5)
(1) edge node {$$f1$$} (2)
(1) edge node {$$f2$$} (6)
(3) edge node {$$f3$$} (2)
(3) edge node {$$f2$$} (4)
(5) edge node {$$f1$$} (4)
(5) edge node {$$f3$$} (6);

\end{tikzpicture}
• Welcome to TeX SX! Did you try with tikz-cd for the more circular look? Oct 11 '19 at 12:42
• There are graph drawing libraries that have circular layouts, e.g. the examples on p. 266 of the pgfmanual.
– user194703
Oct 11 '19 at 12:47
• Thanks. I'm (very) new to LaTeX so I'm not familiar with any of those libraries. Can you point me to a relevant example?
– Mr F
Oct 11 '19 at 12:59

\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
quotes}

\begin{document}
\begin{tikzpicture}[
MN/.style = {%Main Node
circle, draw, minimum size=15mm, font=\footnotesize,
inner sep = 0pt, outer sep=0pt},
every edge/.style = {draw, -Stealth}
]
\node[MN] (mn0)             {$f1, f2, f3$};
\node[MN] (mn1) at ( 30:3)  {$f1, f2$};
\node[MN] (mn2) at ( 90:3)  {$f2$};
\node[MN] (mn3) at (150:3)  {$f2, f3$};
\node[MN] (mn4) at (210:3)  {$f3$};
\node[MN] (mn5) at (270:3)  {$f1, f3$};
\node[MN] (mn6) at (330:3)  {$f1$};

\foreach \i in {1,3,5}
\path   (mn0) edge["$f3$"]    (mn\i);
\path   (mn1) edge["$f1$" ']  (mn2)
(mn1) edge["$f2$"]    (mn6)
(mn3) edge["$f3$"]    (mn2)
(mn3) edge["$f2$" ']  (mn4)
(mn5) edge["$f1$"]    (mn4)
(mn5) edge["$f3$" ']  (mn6);
\end{tikzpicture}
\end{document}

or with added style for edge labels:

every edge quotes/.style = {font=\footnotesize, inner sep=2pt, sloped, auto}

• Beautiful, thank you!
– Mr F
Oct 11 '19 at 13:07

Just for fun: using TikZ modulo arithmetic. Helps to avoid mislabeling (if I understand the logic, of course).

\documentclass[tikz,border=3mm]{standalone}
\begin{document}
\begin{tikzpicture}[circ/.style={circle,draw,minimum size=4em}]
\node[circ] (n0) {$f_1,f_2,f_3$};
\foreach \X [evaluate=\X as \NextX using {int(1+mod(\X,3))},
evaluate=\X as \PrevX using {int(1+Mod(\X-2,3))}] in {1,2,3}
{
\path (-150+\X*120:3) node[circ] (n\the\numexpr2*\X-1)
{$\ifnum\PrevX<\NextX f_\PrevX,f_\NextX \else f_\NextX,f_\PrevX \fi$}
(-90+\X*120:3) node[circ] (n\the\numexpr2*\X) {$f_\PrevX$}
;
\draw[-stealth] (n0) -- (n\the\numexpr2*\X-1) node[midway,auto]{$f_\X$};
}
\foreach \X [evaluate=\X as \NextX using {int(1+mod(\X,3))},
evaluate=\X as \PrevX using {int(1+Mod(\X-2,3))}] in {1,2,3}
{
\draw[-stealth]  (n\the\numexpr2*\X-1) -- (n\the\numexpr2*\X)
node[midway,auto]{$f_\NextX$};
\ifnum\X=1
\draw[-stealth]  (n\the\numexpr2*\X-1) -- (n6)
node[midway,auto]{$f_\PrevX$};
\else
\draw[-stealth]  (n\the\numexpr2*\X-1) -- (n\the\numexpr2*\X-2)
node[midway,auto]{$f_\PrevX$};
\fi
}
\end{tikzpicture}
\end{document}