컴파일 문제, 가장자리를 통해 노드 연결이 작동하지 않습니다.

컴파일 문제, 가장자리를 통해 노드 연결이 작동하지 않습니다.

일부 노드의 가장자리를 연결하려고 할 때 문제가 있습니다(뒷면에서 이 작업을 수행하고 있습니다). 상단에 있는 노드 중 하나만 선택하고 하단에 사용하려는 노드와 가장자리를 연결하면 컴파일하는 데 문제가 없습니다. 내 코드에 작성된 대로 상단에 있는 다른 노드를 사용하여 이 작업을 수행하려고 시도했지만 컴파일되지 않습니다. 나는 이 작업을 수행하는 더 효율적인 방법이 있다고 믿지만 내가 가진 것에는 어떤 실수도 없습니다. 누군가가 나를 도와줄 수 있기를 바랍니다. 도움을 주시면 감사하겠습니다.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{calc,shapes}
\let\oldemptyset\emptyset
\let\emptyset\varnothing
\begin{document}
\begin{tikzpicture}[every node/.style={circle,draw=black},scale=0.75,every 
node/.append style={transform shape}]
\node(tre1)[circle,draw,scale=0.5]{
\begin{tikzpicture}
\node(one){1}
child{node{2}}
child{node{3}};
\end{tikzpicture}
};
\node(tre2)[circle,draw,scale=0.5] [right of=tre1,xshift=6.2cm]{
\begin{tikzpicture}
\node(tree2){1}
child{node{2}
child{node{3}}};
\end{tikzpicture}
};
\node at ($(tre1) + (-3.5,-4.5)$)[circle,draw,scale=0.65](tr1){
\begin{tikzpicture}
\node(one){1}
child{node{2}};
\node[xshift=1cm]{3};
\end{tikzpicture}
};
\node(tr2)[circle,draw,scale=0.65][right of=tr1,xshift=2.8cm]{
\begin{tikzpicture}
\node(one){1}
child{node{3}};
\node[right of=one]{2};
\end{tikzpicture}
};
\node(tr3)[circle,draw,scale=0.75][right of=tr2,xshift=2.25cm]{
\begin{tikzpicture}
\node(two){2}
child{node{3}};
\node[right of=one]{1};
\end{tikzpicture}
};
\node at ($(tre1) + (2,-13.5)$)(root)[circle,draw,scale=0.9]{
\begin{tikzpicture}  
\node(one){1};
\node[below of=one](two){2};
\node[right of=one]{3};
\node[right of=two]{4};
\end{tikzpicture}
};   
\path[thick](tre1.south)edge node[sloped,yshift=0.5em,draw=none,fill=none]{} 
(tr1.north)
edge node[sloped,yshift=0.5em,draw=none,fill=none]{}(tr2.north)
\path[thick](tre2.south)edge node[sloped,yshift=0.5em,draw=none,fill=none]{} 
(tr3.north)

\end{tikzpicture};
\end{document}

여기에 이미지 설명을 입력하세요\end{문서}

답변1

이는 아직 원하는 것이 아닐 가능성이 높지만 중첩을 피하고 tikzpicture원하는 것을 얻기 위한 기반이 될 수 있습니다.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amssymb}
\usepackage{tikz}
\usetikzlibrary{calc,shapes,fit,positioning}
\let\oldemptyset\emptyset
\let\emptyset\varnothing
\begin{document}
\begin{tikzpicture}[every node/.style={circle,draw=black},scale=0.75,every 
node/.append style={transform shape}]
\begin{scope}[local bounding box=f1,scale=0.5]
\node(one1){1}
child{node{2}}
child{node{3}};
\end{scope}
\node[circle,draw,fit=(f1)](tre1){};
%
\begin{scope}[local bounding box=f2,scale=0.5]
\node[above right=0.1cm and 10cm of one1](tree2){1}
child{node{2}
child{node{3}}};
\end{scope}
\node(tre2)[circle,draw,fit=(f2)] {};
%
\begin{scope}[local bounding box=f3,scale=0.65]
\node at ($(one1) + (-3.5,-4.5)$) (one2){1}
child{node{2}};
\node[right=of one2]{3};
\end{scope}
\node [circle,draw,fit=(f3)](tr1){};
%
\begin{scope}[local bounding box=f4,scale=0.65]
\node[right=4cm of one2] (one3){1}
child{node{3}};
\node[right of=one3]{2};
\end{scope}
\node(tr2)[circle,draw,fit=(f4)]{};
%
\begin{scope}[local bounding box=f5,scale=0.75]
\node[right=3cm of one3] (two1){2}
child{node{3}};
\node[right=of two1]{1};
\end{scope}
\node(tr3)[circle,draw,fit=(f5)]{};
%
\begin{scope}[local bounding box=f6,scale=0.9]  
\node at ($(one1) + (2,-13.5)$) (one4){1};
\node[below of=one4](two2){2};
\node[right of=one4]{3};
\node[right of=two2]{4};
\end{scope}
\node[circle,draw,fit=(f6)]  (root){};   
%
\path[thick](tre1.south)edge %node[sloped,yshift=0.5em,draw=none,fill=none]{} 
(tr1.north) (tre1.south)
edge %node[sloped,yshift=0.5em,draw=none,fill=none]{}
(tr2.north);
\path[thick](tre2.south)edge %node[sloped,yshift=0.5em,draw=none,fill=none]{} 
(tr3.north);
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

관련 정보