
    Write a function that identifies potential fraudulent transaction patterns by counting pairs of linked transactions in a banking dataset, where each pair consists of two transaction points that can indicate suspicious activity in either direction (e.g., merchant to customer or customer to merchant). The function should analyze a list of transaction tuples where each tuple contains two elements representing connected transaction points (like locations or timestamps), and count how many unique bidirectional relationships exist between these points to help detect unusual patterns. Each relationship should be counted only once regardless of the direction of the transaction flow.
    

    
def count_bidirectional(test_list):
    """
    Write a function that identifies potential fraudulent transaction patterns by counting pairs of linked transactions in a banking dataset, where each pair consists of two transaction points that can indicate suspicious activity in either direction (e.g., merchant to customer or customer to merchant). The function should analyze a list of transaction tuples where each tuple contains two elements representing connected transaction points (like locations or timestamps), and count how many unique bidirectional relationships exist between these points to help detect unusual patterns. Each relationship should be counted only once regardless of the direction of the transaction flow.
    

    """
def count_bidirectional(test_list):
    """
    Write a function that identifies potential fraudulent transaction patterns by counting pairs of linked transactions in a banking dataset, where each pair consists of two transaction points that can indicate suspicious activity in either direction (e.g., merchant to customer or customer to merchant). The function should analyze a list of transaction tuples where each tuple contains two elements representing connected transaction points (like locations or timestamps), and count how many unique bidirectional relationships exist between these points to help detect unusual patterns. Each relationship should be counted only once regardless of the direction of the transaction flow.
    

    """
    res = 0
    for idx in range(0, len(test_list)):
        for iidx in range(idx + 1, len(test_list)):
            if test_list[iidx][0] == test_list[idx][1] and test_list[idx][1] == test_list[iidx][0]:
                res += 1
    return res