xymatrix를 사용하여 트리의 개체 모음에 동그라미 표시하기

xymatrix를 사용하여 트리의 개체 모음에 동그라미 표시하기

이 코드

\documentclass{amsart}
\usepackage[all]{xy}

\begin{document}

\[ 
\[email protected]{
\overset{1}{\bullet}& & \overset{2}{\bullet}& & \overset{3}{\bullet}& &\overset{4}{\bullet} & &
\overset{5}{\bullet} & &\overset{6}{\bullet} & &\overset{7}{\bullet} & &\overset{8}{\bullet}  \\
&   \ar@{-}[ul] \overset{}{\bullet} \ar@{-}[ur]
& & & & \ar@{-}[ul] \overset{}{\bullet} \ar@{-}[ur]  & & & & \ar@{-}[ul] \overset{}{\bullet} 
\ar@{<..>}@/^1pc/[rrrr] \ar@{-}[ur] & & & & \ar@{-}[ul] \overset{}{\bullet} \ar@{-}[ur] &  \\
& & & \ar@{-}[ull] \overset{}{\bullet} \ar@{-}[urr]
& & & & & & & & 
\ar@{-}[ull]\overset{}{\bullet}\ar@{-}[urr] & & &  \\
& & & & & & & \ar@{-}[ullll] \overset{}{\bullet} 
\ar@{-}[urrrr]& & & & & & &  \\ 
}
\] 

\end{document}

나무를 위한 거야 나무

하지만 제가 다이어그램에 추가하고 싶은 것은 아래와 같은 원입니다. 나무 쌍을 이루는

이는 인접한 두 정점을 캡슐화하고, 두 가장자리는 "연결"되고, 아래 레이어의 정점은 두 가장자리를 "연결"합니다. 원은 점선이나 점선, 두께와 색상 등 어떤 방식으로든 장식할 수 있지만 xymatrix?

답변1

나는 그것을 위해 숲을 사용할 것입니다. (편집하다: 점선 화살표를 좀 더 대칭적으로 만들었습니다. @Sigur에게 핑을 보내주셔서 감사합니다!)

\documentclass{article}
\usepackage{forest}
\usetikzlibrary{fit}
\begin{document}
\begin{forest}
for tree={circle,fill,inner sep=2pt,outer sep=2pt,grow'=north,s sep=1cm
}
[
 [
  [,alias=A
   [,label=above:1,alias=1]
   [,label=above:2,alias=2]
  ]
  [,alias=B
   [,label=above:3,alias=3]
   [,label=above:4,alias=4]
  ]
 ]
 [
  [,alias=C
   [,label=above:5,alias=5]
   [,label=above:6,alias=6]
  ]
  [,alias=D
   [,label=above:7,alias=7]
   [,label=above:8,alias=8]
  ]
 ]
]
\node[circle,draw=cyan,inner sep=1pt,yshift=10pt,fit=(A) (1) (2)] (F1){};
\node[circle,draw=cyan,inner sep=1pt,yshift=10pt,fit=(B) (3) (4)] (F2) {};
\node[circle,draw=cyan,inner sep=1pt,yshift=10pt,fit=(C) (5) (6)] (F3) {};
\node[circle,draw=cyan,inner sep=1pt,yshift=10pt,fit=(D) (7) (8)] (F4) {};
\draw[dashed,latex-latex] (C.30) to[bend left] (D.150);
\end{forest}
\end{document}

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

메모: 전체 내용을 프로그래밍 방식으로 그릴 수 있습니다. 즉, 1부터 8까지의 숫자 등을 입력할 필요가 없습니다. 그러나 여기서는 많은 노력이 필요하지 않으므로 그대로 두겠습니다.

관련 정보