0

I would like to create certain graphs in Tikz with a given node distance. I tried:

\documentclass{amsart}

\usepackage{tikz}
\usetikzlibrary{graphs,graphdrawing,positioning,graphdrawing.layered}

\begin{document}

Setting the distance does not work:
\[
    \begin{tikzpicture}[node distance=10pt]
        \graph[nodes={draw,circle,minimum size=5pt,inner sep=0pt,as=}]
        { 1--[draw=gray]2--[draw=gray]3; 1--[bend left]3; };
    \end{tikzpicture}
\]

Setting the distance works:
\[
    \begin{tikzpicture}
        \graph[layered layout,grow=right,level distance=10pt,nodes={draw,circle,minimum size=5pt,inner sep=0pt,as=}]
        { 1--[draw=gray]2--[draw=gray]3;  };
    \end{tikzpicture}
\]

Adding third edge changes layout:
\[
    \begin{tikzpicture}
        \graph[layered layout,grow=right,level distance=10pt,nodes={draw,circle,minimum size=5pt,inner sep=0pt,as=}]
        { 1--[draw=gray]2--[draw=gray]3;  1--[bend left]3; };
    \end{tikzpicture}
\]

\end{document}

resulting in

graph output

Basically I want the first graph but with the node distance of the second graph. So my question is, how can I set the node distance in \graph without specifying a layout (like the layered layout)?

1
  • is it ok now -- if not please give a hand sketch of the desired output – js bibra Jan 21 at 14:36
1

enter image description here

\documentclass{amsart}

\usepackage{tikz}
\usetikzlibrary{graphs,positioning,}

\begin{document}

Setting the distance does not work:
\[
    \begin{tikzpicture}
        \graph[nodes={draw,circle,minimum size=5pt,inner sep=0pt,as=}]
        { 1--[draw=gray]2--[draw=gray]3; 1--[bend left]3; };
    \end{tikzpicture}
\]

Setting the distance works:
\[
    \begin{tikzpicture}
        \graph[nodes={draw,circle,minimum size=5pt,inner sep=0pt,as=}]
        { 1--[draw=gray]2--[draw=gray]3;  };
    \end{tikzpicture}
\]

Adding third edge changes layout:
\[
    \begin{tikzpicture}
        \graph[nodes={draw,circle,minimum size=5pt,inner sep=0pt,as=}]
        { 1--[draw=gray]2--[draw=gray]3;  1--[bend left]3; };
    \end{tikzpicture}
\]

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.