def METHOD_NAME(
    row: Tensor,
    col: Tensor,
    rev_row: Tensor,
    rev_col: Tensor,
    edge_id: OptTensor = None,
    rev_edge_id: OptTensor = None,
) -> Tuple[Tensor, Tensor, OptTensor]:
    assert row.numel() == col.numel()
    assert rev_row.numel() == rev_col.numel()
    edge_index = row.new_empty(2, row.numel() + rev_row.numel())
    edge_index[0, :row.numel()] = row
    edge_index[1, :row.numel()] = col
    edge_index[0, row.numel():] = rev_col
    edge_index[1, row.numel():] = rev_row
    if edge_id is not None:
        edge_id = torch.cat([edge_id, rev_edge_id], dim=0)
    (row, col), edge_id = coalesce(edge_index, edge_id, reduce='any')
    return row, col, edge_id