public DecompositionNode(BitSet set, int index, DecompositionTree tree)
 {
     this.Tree         = tree;
     this.Index        = index;
     this.SubTreeWidth = this.SubTreeSum = this.Width = tree.WidthParameter.GetWidth(tree.Graph, set);
     this.Set          = set;
 }
        /// <summary>
        /// A deep copy of this subtree.
        /// </summary>
        /// <param name="tree">The original tree.</param>
        /// <param name="parent">The parent of the copied node.</param>
        /// <returns>A deep copy of the node.</returns>
        public DecompositionNode CopyTree(DecompositionTree tree, DecompositionNode parent)
        {
            DecompositionNode node = tree.Nodes[this.Index] = new DecompositionNode(this, tree);

            node.Parent = parent;
            if (!this.IsLeaf)
            {
                node.Left  = this.Left.CopyTree(tree, node);
                node.Right = this.Right.CopyTree(tree, node);
            }
            return(node);
        }
 public DecompositionNode(DecompositionNode node, DecompositionTree tree = null)
 {
     this.Set          = new BitSet(node.Set);
     this.Left         = node.Left;
     this.Right        = node.Right;
     this.Parent       = node.Parent;
     this.Branch       = node.Branch;
     this.Width        = node.Width;
     this.SubTreeWidth = node.SubTreeWidth;
     this.SubTreeSum   = node.SubTreeSum;
     this.Index        = node.Index;
     this.vertex       = node.vertex;
     this.Tree         = tree != null ? tree : node.Tree;
 }
 public DecompositionNode(Vertex vertex, int index, DecompositionTree tree) : this(new BitSet(tree.VertexCount, vertex.Index), index, tree)
 {
     this.vertex = vertex;
 }
 public DecompositionTree(DecompositionTree tree, WidthParameter width = null) : this(tree.Graph, width != null ? width : tree.WidthParameter)
 {
     this.Root = tree.Root.CopyTree(this, null);
 }