
    Write a function to analyze patient readmission patterns by counting unique pairs of related medical events, where each pair represents a bidirectional relationship between admission-readmission incidents, diagnosis-treatment combinations, or symptom-condition associations. The function should consider (event1, event2) and (event2, event1) as equivalent pairs when counting, as the order of medical events may not affect their clinical significance in predicting readmission risk.
    

    
def count_bidirectional(test_list):
    """
    Write a function to analyze patient readmission patterns by counting unique pairs of related medical events, where each pair represents a bidirectional relationship between admission-readmission incidents, diagnosis-treatment combinations, or symptom-condition associations. The function should consider (event1, event2) and (event2, event1) as equivalent pairs when counting, as the order of medical events may not affect their clinical significance in predicting readmission risk.
    

    """
def count_bidirectional(test_list):
    """
    Write a function to analyze patient readmission patterns by counting unique pairs of related medical events, where each pair represents a bidirectional relationship between admission-readmission incidents, diagnosis-treatment combinations, or symptom-condition associations. The function should consider (event1, event2) and (event2, event1) as equivalent pairs when counting, as the order of medical events may not affect their clinical significance in predicting readmission risk.
    

    """
    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