3

This code

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

\begin{document}

\[ 
\xymatrix@-0.75pc{
\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}

is for the tree tree

but what I would like to add to the diagram are the circles as seen below: tree-paired

which encapsulate the top two adjacent vertices, the two edges "connected" to them, and the vertex in the layer below, "connecting" the two edges. The circles can be decorated in any way, e.g., dotted or dashed, in any thickness and color, but is it possible to do this using xymatrix?

1 Answers1

4

I'd use forest for that. (EDIT: made the dashed arrow more symmetric, thanks to @Sigur for pingng me!)

\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}

enter image description here

NOTE: You could draw the full thing programmatically, meaning you do not have to punch in the numbers 1 to 8 and so on. But given that here this is not much effort, I leave it as is.