0

I'm trying to recreate the diagram on this website: http://www.njohnston.ca/2013/04/the-minimal-superpermutation-problem/ and am finding difficulty with joining all the nodes in the third row to a singular node. This is what I have got so far:

\begin{center} 
\begin{tikzpicture}[sibling distance=5em,
  every node/.style = {shape=circle,
    draw, align=center,}]]
  \node {$123121321$}
    child { node {123} 
        child {node {1234123} } }
    child { node {231}
            child {node {2314231} } }
    child {node {312} 
        child {node {3124312} } }
    child {node {213} 
        child {node {2134213} } }
    child {node {132}
        child {node {1324132} } }
    child {node {321}
        child {node {3214321} } }; 
\end{tikzpicture}
\end{center} 
  • 1
    Welcome to TeX.se. Please don't post code fragments, but instead put your fragment into a complete compilable document. – Alan Munn Apr 8 at 20:21
1

I'd use forest. The \foreach loop at the end can be used for your original code, too (after changing the node names).

\documentclass[border=3.14mm]{standalone}
\usepackage[edges]{forest}
\usetikzlibrary{shapes.geometric}
\begin{document}

    \begin{forest}
for tree={draw, ellipse,edge={-latex}}
[123121,alias=top
    [123
        [1234123,alias=n-1]
    ]
    [231
        [2314231,alias=n-2]
    ]
    [312
        [3124312,alias=n-3]
    ]
    [213
        [2134213,alias=n-4]
    ]
    [132
        [1324132,alias=n-5]
    ]
    [321
        [3214321,alias=n-6]
    ]
]
\node[ellipse,draw] (Pft) at ([yshift=-pi*1.1cm]top) {1234\dots};
\foreach \X in {1,...,6}
{\draw[-latex] (n-\X) -- (Pft);}
\end{forest}
\end{document}

enter image description here

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.