Surrounding Nodes with an Ellipse in TikZ

One possibility using the calc library to draw some rotated ellipses:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,shapes}

\begin{document}

\begin{tikzpicture}[every node/.style={draw}] 
\node (l1) at (0,0) [circle] {};
\node (l2) at (2,0) [circle] {};
\node (l3) at (4,0) [circle] {};
\node (m1) at (1, 1.732) [circle] {};
\node (m2) at (3, 1.732) [circle] {};
\node (h1) at (2, 3.464) [circle] {};
\draw let \p1=(h1), \p2=(l1), \n1={atan2(\y2-\y1,\x2-\x1)}, \n2={veclen(\y2-\y1,\x2-\x1)}
  in ($ (h1)!0.5!(l1) $) ellipse [x radius=\n2/2+20pt, y radius=0.7cm,rotate=90-\n1];
\draw let \p1=(h1), \p2=(l3), \n1={atan2(\y2-\y1,\x2-\x1)}, \n2={veclen(\y2-\y1,\x2-\x1)}
  in ($ (h1)!0.5!(l3) $) ellipse [x radius=\n2/2+20pt, y radius=0.7cm,rotate=90-\n1];
\draw let \p1=(l1), \p2=(l3), \n1={atan2(\y2-\y1,\x2-\x1)}, \n2={veclen(\y2-\y1,\x2-\x1)}
  in ($ (l1)!0.5!(l3) $) ellipse [x radius=\n2/2+20pt, y radius=0.7cm,rotate=90-\n1];
\end{tikzpicture}

\end{document}

enter image description here

Tags:

Tikz Pgf