Using Comprehensions to Handle a Large Dataset in Python 2.7
As requested:

Sort the list according to the component names. To achieve a correct order, either swap component names when necessary, or supply the custom comparator (which will account for (componentA, componentB) being the same thing as (componentB, componentA)).

Once the list is sorted, the entries to be tallied are adjacent, and an actual tallies could be computed in a single pass over the list.