# Output O: List of (S, minr, maxr): # S: Subtrees covering the group. # minr: Lower bound of Subgroup Range # maxr: Upper bound of Subgroup Range O=[] S=[] depth=int(math.log(len(T)+1,2)-1) def rightmost_leaf_number(n): # Input n: subtree root node # Output y: rightmost leaf number under the subtree h=n.index.len # hierarchy level of node n x=int(n.index.val, 2) # node index in decimal y=(x+1)*(2**(depth-h))-1 return y def check(n): # Input n: subtree root node # Output 0, 1 # 0 : Some node in the subtree is a non-member of the group. # 1 : All nodes in the subtree are members of the group. global minr rv=0 if n.left==None and n.right==None: # n is leaf if n.index.val in I: S.append(n) return 1 return 0 # n is non-leaf
# Output O: List of (S, minr, maxr): # S: Subtrees covering the group. # minr: Lower bound of Subgroup Range # maxr: Upper bound of Subgroup Range O=[] S=[] depth=int(math.log(len(T)+1,2)-1) def rightmost_leaf_number(n): # Input n: subtree root node # Output y: rightmost leaf number under the subtree h=n.index.len # hierarchy level of node n x=int(n.index.val, 2) # node index in decimal y=(x+1)*(2**(depth-h))-1 return y def check(n): # Input n: subtree root node # Output 0, 1 # 0 : Some node in the subtree is a non-member of the group. # 1 : All nodes in the subtree are members of the group. global minr rv=0 if n.left==None and n.right==None: # n is leaf if n.index.val in I: S.append(n) return 1 return 0 # n is non-leaf
21-13-0227-03-MuGM-restructure-cluase-9-4.docx