Aligning TikZ trees with other nodes

I would like to align a TikZ tree with another node by considering the tree as a whole like as if it was a node with anchors. For the moment I am only able to align the root node of the tree, not the whole tree itself. I use PGF 2.10.

The following picture shows what I have:

What I want is that the left node and the tree are horizontally aligned and the arrow goes from the east anchor of the left node to the west anchor of the tree, i.e. more or less the left child of the root node as shown here:

Please ignore the outer border on both images.

Do you know a way to achieve this?

My test code is given below. I compile it with xelatex.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,calc,positioning,trees}
\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\newlength{\imagewidth}
\newlength{\imagescale}

\begin{document}
\begin{tikzpicture}[
->, >=stealth', shorten >=1pt, semithick, node distance=1cm, level distance=7mm, level/.style={sibling distance=10mm/#1},
block/.style = {draw, rectangle, rounded corners, minimum height=1cm},
every node/.style={circle, draw, fill=none, anchor=north}
]

\node [block] (SOURCE DOCUMENT) {\parbox{2cm}{\centering source document}};

\node (SOURCE TREE)[right=of SOURCE DOCUMENT] {}
child { node {} }
child { node {}
child { node {} }
child { node {} }
};

\draw [->] (SOURCE DOCUMENT) edge (SOURCE TREE);
\end{tikzpicture}
\end{document}

-
In case you want to know how to align multiple trees with other nodes, go read the post Aligning multiple TikZ trees with other nodes –  Ludovic Kuty May 4 '11 at 20:14

Using fit library you may create additional node, that would contain every node in your tree. After that use it's anchors to perform your justification.

Here's result of such solution:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,calc,positioning,trees,fit}
\usepackage[graphics,tightpage,active]{preview}
\PreviewEnvironment{tikzpicture}
\newlength{\imagewidth}
\newlength{\imagescale}

\begin{document}
\begin{tikzpicture}[
->, >=stealth', shorten >=1pt, semithick, node distance=1cm, level distance=7mm, level/.style={sibling distance=10mm/#1},
block/.style = {draw, rectangle, rounded corners, minimum height=1cm},
every node/.style={circle, draw, fill=none, anchor=north}
]

\node (SOURCE TREE) {}
child { node {} }
child { node {}
child { node {} }
child { node {} }
};

\node[fit=(SOURCE TREE) (SOURCE TREE-1) (SOURCE TREE-2) (SOURCE TREE-2-1) (SOURCE TREE-2-2),
draw=none, rectangle, inner sep=0] (whole tree) {};

\node[block, left=of whole tree] (SOURCE DOCUMENT) {\parbox{2cm}{\centering source document}};

\draw (SOURCE DOCUMENT) -- (whole tree);
\end{tikzpicture}
\end{document}


-
Thank you. It works just how I wanted to. Listing all the nodes of the tree in the fit option is quite tedious but I found out that I can just list the "outer" child nodes (root, left child of root and rightmost node) to get the right bounding box. I also like your notation SOURCE TREE-2-1 avoiding to name the nodes explicitly. –  Ludovic Kuty Apr 24 '11 at 14:17
@Ludovic: 1. on notation - this is how TikZ works. No credentials for me. 2. on tediousness - my answer to my own question may shed some light on how to avoid this: tex.stackexchange.com/questions/15147/…. 3. Listing outer nodes is completely legal. –  Dmitry Volosnykh Apr 24 '11 at 14:34

Instead of placing the tree to the right of the box, place the box to the left of the (selected, suitably named) child node:

...
\node (SOURCE TREE) {}
child { node (x) {} }
child { node {}
child { node {} }
child { node {} }
};

\node [block,left=of x] (SOURCE DOCUMENT) {\parbox{2cm}{\centering source document}};

\draw [->] (SOURCE DOCUMENT) edge (x);
...

-
That's a good idea except that is specific to my example of a tree having an odd depth and containing edges of equal sizes. I prefer the solution given above because it works in all cases and I also have a bounding box with the fitting node that I can use to do other things. –  Ludovic Kuty Apr 24 '11 at 14:15