Using the graphdrawing library for TikZ, is it possible to draw the following graph
with this formatting?
I have used the following code to draw it "manually":
\tikz[nodes={circle, draw}] {
\node (1) at (0,0) {1};
\node (2) at (-1.5,-1.5) {2};
\node (5) at (0, -1.5) {5};
\node (4) at (1.5, -1.5) {4};
\node (3) at (0, -3) {3};
\graph {
(1)--(2)--(3)--(4)--(1); (2)--(5)--(4);
};
}
However, I have to draw a lot of similar graphs, and this becomes very tedious. And it seems to me that force-based layouts in the graphdrawing library must be suited to achieve this particular formatting of the graph (since it is very "balanced").
But I have not had any success using something like
\tikz \graph [spring layout, nodes={circle, draw}, node distance=1.5cm, horizontal=2 to 4]{
1--2--3--4--1; 2--5--4;
};
and not with spring electrical layout either. I have tried tuning different parameters (see section 32.1 in the TikZ manual), but nothing seems to produce the right result. I can't even prevent the edges from overlapping.
Have I misunderstood what the graphdrawing library should be used for? And is there not any shorter way to draw the graph, in this natural formatting, other than manually defining the positions of the nodes?