def build_dependency_tree_from_mi(mut_info, scope, root_var=None):
    if (root_var is None):
        root_var = np.random.choice(scope)
    elif (root_var not in scope):
        raise RootVarError()
    root_id = scope.index(root_var)
    mst = minimum_spanning_tree((- (mut_info + 1)))
    dfs_tree = depth_first_order(mst, directed=False, i_start=root_id)
    tree = dfs_tree[1].tolist()
    tree[root_id] = ROOT
    dtree_nodes = {var_id: DTreeNode(var_id) for var_id in scope}
    parents = np.arange(mut_info.shape[0]).tolist()
    parents.remove(root_id)
    for p in parents:
        dtree_nodes[scope[p]].set_parent(dtree_nodes[scope[tree[p]]])
    dtree_nodes[scope[root_id]].set_tree(scope, tree)
    return dtree_nodes[scope[root_id]]
def build_dependency_tree_from_mi(mut_info, scope, root_var=None):
    if (root_var is None):
        root_var = np.random.choice(scope)
    elif (root_var not in scope):
        raise RootVarError()
    root_id = scope.index(root_var)
    mst = minimum_spanning_tree((- (mut_info + 1)))
    dfs_tree = depth_first_order(mst, directed=False, i_start=root_id)
    tree = dfs_tree[1].tolist()
    tree[root_id] = ROOT
    dtree_nodes = {var_id: DTreeNode(var_id) for var_id in scope}
    parents = np.arange(mut_info.shape[0]).tolist()
    parents.remove(root_id)
    for p in parents:
        dtree_nodes[scope[p]].set_parent(dtree_nodes[scope[tree[p]]])
    dtree_nodes[scope[root_id]].set_tree(scope, tree)
    return dtree_nodes[scope[root_id]]