code: def computePairwisePreferences(self, profile):
          cands = profile.candMap.keys()
          pairwisePreferences = dict()
          for cand in cands:
              pairwisePreferences[cand] = dict()
          for cand1 in cands:
              for cand2 in cands:
                  if cand1 != cand2:
                      pairwisePreferences[cand1][cand2] = 0
          for preference in profile.preferences:
              wmgMap = preference.wmgMap
              for cand1, cand2 in itertools.combinations(cands, 2):
                  if cand1 not in wmgMap.keys():
                      if cand2 in wmgMap.keys():
                          pairwisePreferences[cand2][cand1] += 1 * preference.count
                  elif cand2 not in wmgMap.keys():
                      if cand1 in wmgMap.keys():
                          pairwisePreferences[cand1][cand2] += 1 * preference.count
                  elif wmgMap[cand1][cand2] == 1:
                      pairwisePreferences[cand1][cand2] += 1 * preference.count
                  elif wmgMap[cand1][cand2] == -1:
                      pairwisePreferences[cand2][cand1] += 1 * preference.count
          return pairwisePreferences