def _redirect_edge(self, u_id, v_id, new_v_id):
        """Redirect the layer to a new node.
        Change the edge originally from `u_id` to `v_id` into an edge from `u_id` to `new_v_id`
        while keeping all other property of the edge the same.
        """
        layer_id = None
        for index, edge_tuple in enumerate(self.adj_list[u_id]):
            if edge_tuple[0] == v_id:
                layer_id = edge_tuple[1]
                self.adj_list[u_id][index] = (new_v_id, layer_id)
                self.layer_list[layer_id].output = self.node_list[new_v_id]
                break

        for index, edge_tuple in enumerate(self.reverse_adj_list[v_id]):
            if edge_tuple[0] == u_id:
                layer_id = edge_tuple[1]
                self.reverse_adj_list[v_id].remove(edge_tuple)
                break
        self.reverse_adj_list[new_v_id].append((u_id, layer_id))
        for index, value in enumerate(self.layer_id_to_output_node_ids[layer_id]):
            if value == v_id:
                self.layer_id_to_output_node_ids[layer_id][index] = new_v_id
                break
def _redirect_edge ( self , u_id , v_id , new_v_id ) : layer_id = None for index , edge_tuple in enumerate ( self . adj_list [ u_id ] ) : if edge_tuple [ 0 ] == v_id : layer_id = edge_tuple [ 1 ] self . adj_list [ u_id ] [ index ] = ( new_v_id , layer_id ) self . layer_list [ layer_id ] . output = self . node_list [ new_v_id ] break for index , edge_tuple in enumerate ( self . reverse_adj_list [ v_id ] ) : if edge_tuple [ 0 ] == u_id : layer_id = edge_tuple [ 1 ] self . reverse_adj_list [ v_id ] . remove ( edge_tuple ) break self . reverse_adj_list [ new_v_id ] . append ( ( u_id , layer_id ) ) for index , value in enumerate ( self . layer_id_to_output_node_ids [ layer_id ] ) : if value == v_id : self . layer_id_to_output_node_ids [ layer_id ] [ index ] = new_v_id break
Redirect the layer to a new node.
        Change the edge originally from `u_id` to `v_id` into an edge from `u_id` to `new_v_id`
        while keeping all other property of the edge the same.