def delete_node_1ton(node_list, begin, node, end):  # type: ([],LinkedNode, LinkedNode, LinkedNode)->[]
        """
        delete the node which has 1-input and n-output
        """
        if end is None:
            assert end is not None
            end = node.successor
        elif not isinstance(end, list):
            end = [end]

        if any(e_.in_or_out for e_ in end):
            # if the end is output node, the output name will be kept to avoid the model output name updating.
            begin.out_redirect(node.single_input, node.single_output)
        else:
            for ne_ in end:
                target_var_name = node.single_input
                # since the output info never be updated, except the final.
                assert target_var_name in begin.output.values()
                ne_.in_redirect(node.single_output, target_var_name)

        begin.successor = [v_ for v_ in begin.successor if v_ != node] + node.successor
        for ne_ in end:
            ne_.precedence = [begin if v_ == node else v_ for v_ in ne_.precedence]

        node_list.remove(node)
        return node_list
def delete_node_1ton ( node_list , begin , node , end ) : if end is None : assert end is not None end = node . successor elif not isinstance ( end , list ) : end = [ end ] if any ( e_ . in_or_out for e_ in end ) : begin . out_redirect ( node . single_input , node . single_output ) else : for ne_ in end : target_var_name = node . single_input assert target_var_name in begin . output . values ( ) ne_ . in_redirect ( node . single_output , target_var_name ) begin . successor = [ v_ for v_ in begin . successor if v_ != node ] + node . successor for ne_ in end : ne_ . precedence = [ begin if v_ == node else v_ for v_ in ne_ . precedence ] node_list . remove ( node ) return node_list
delete the node which has 1-input and n-output