\begin{tikzpicture}[
  plA/.style={rectangle,draw, minimum width=2em, minimum height=2em,
    inner sep=0},
  plB/.style={circle,draw, minimum width=2em, minimum height=2em,
    inner sep=0},
  infsetB/.style={dashed, draw},
  level 1/.style={sibling distance=12em},
  level 2/.style={sibling distance=6em},
  level 3/.style={sibling distance=2.5em}
  ]
  
  \node(root)[plA] {}
  child { node(h1)[plB,xshift=7em] {$h_1$}
    child { node(l2s1a)[plA,xshift=-7em] {}
      child {node(h4)[plB] {$h_4$}}
      child {node(h5)[plB] {$h_5$}}
      child {node(h6)[plB] {$h_6$}}
    }
    child{ node(l2s1b)[plA,xshift=-7em] {}
      child {node(h7)[plB] {$h_7$}}
      child {node(h8)[plB] {$h_8$}}
    }
  }
  child{ node(h2)[plB] {$h_2$}
    child { node(l2s2a)[plA] {}
      child {node(h9)[plB] {$h_9$}}
      child {node(h10)[plB] {$h_{10}$}}
      child {node(h11)[plB] {$h_{11}$}}
      edge from parent node[pos=0.5,red]{$m_1$}
    }
    child{ node(l2s3a)[plA] {}
      child {node(h12)[plB] {$h_{12}$}}
      child {node(h13)[plB] {$h_{13}$}}
      edge from parent node[pos=0.5,red]{$m_2$}
    }
  }
  child{ node(h3)[plB] {$h_3$}
    child {node(l2s4a)[plA] {}
      child {node(h14)[plB] {$h_{14}$}}
      child {node(h15)[plB] {$h_{15}$}}
      edge from parent node[pos=0.5,red]{$m_1$}
    }
    child {node(l2s4b)[plA] {}
      child {node(h16)[plB] {$h_{16}$}}
      child {node(h17)[plB] {$h_{17}$}}
      edge from parent node[pos=0.5,red]{$m_2$}
    }
  };

  \node(is1) [fit=(h1),infsetB,rounded corners,label=$i_1$] {};
  \node(is2) [fit=(h2)(h3),infsetB,rounded corners,label=$i_2$] {};
  \node(is3) [fit=(h4)(h5)(h6),infsetB,rounded corners,inner sep=0,label=$i_3$] {};
  \node(is4) [fit=(h7)(h8),infsetB, rounded corners,inner sep=0,label=$i_4$] {};
  \draw[infsetB] plot [smooth cycle] coordinates {
    (h9.north west) (h9.west) (h9.south west)
    ($ (h9.south) + (0, -.5em) $)
    ($ (h12.south) + (0,-2em) $) (h14.south east) (h14.north east)
    (h14.north west)
    ($ (h13.south) + (0, -.5em) $)
    ($ (h12.south) + (0, -1em) $)
    ($ (h11.south) + (0,-.5em) $)
    (h10.north east)
  };
  \node[below=of h10,yshift=2em]{$i_5$};

  \node(is6) [fit=(h11),infsetB, rounded corners,inner sep=0,label=$i_6$] {};
  \node(is7) [fit=(h12)(h13),infsetB, rounded corners,inner sep=0,label=$i_7$] {};

  \node(is8) [fit=(h15),infsetB, rounded corners,inner sep=0,label=$i_8$] {};
  \node(is9) [fit=(h16)(h17),infsetB, rounded corners,inner sep=0,label=$i_9$] {};


   
\end{tikzpicture}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "prez"
%%% End:
