private void buildTree(Node node) { if (objects.Contains(node)) { if (!strict) return; throw new NotATreeException(); } objects.Add(node); // get the appropriate arrows ArrowCollection arrows = new ArrowCollection(); if (reversedDir) node.getAllIncomingArrows(arrows); else node.getAllOutgoingArrows(arrows); // build subtrees recursively foreach (Arrow a in arrows) { if (enumArrows) objects.Add(a); buildTree(reversedDir ? a.Origin : a.Destination); } }