Beispiel #1
0
        /// <summary>
        /// Applies preorder ordering to this tree
        /// </summary>
        /// <returns>tree as preorder string</returns>
        public String preorder()
        {
            if (this.root == null)
                return "";

            String res = "Vertex " + this.root.ToString();

            if (this.root.OutgoingEdges == null)
                return res;

            foreach(Edge e in this.root.OutgoingEdges)
            {
                res += "\nEDGE " + e.ToString() + "\n";
                Tree subtree = new Tree(SplitSize, Depth - 1, VertexAttributes, EdgeAttributes);
                subtree.root = e.Bottom;
                res += subtree.preorder();
            }
            return res;
        }