Fix incorrect building of the tree: the last node of each bag was not considered for linking
Fix incorrect building of the tree: the last node of each bag was not considered for linking

smaniu/treewidth,smaniu/treewidth