def genWmgMapFromRankMap(self, rankMap):
        """
        Converts a single rankMap into a weighted majorty graph (wmg). We return the wmg as a 
        two-dimensional dictionary that associates integer representations of each pair of candidates,
        cand1 and cand2, with the number of times cand1 is ranked above cand2 minus the number of times
        cand2 is ranked above cand1. This is called by importPreflibFile().

        :ivar list<int> candList: Contains integer representations of each candidate.
        :ivar dict<int,int> rankMap: Associates integer representations of each candidate with its
            ranking in a single vote.
        """

        wmgMap = dict()
        for cand1, cand2 in itertools.combinations(rankMap.keys(), 2):

            # Check whether or not the candidates are already present in the dictionary.
            if cand1 not in wmgMap.keys():
                wmgMap[cand1] = dict()
            if cand2 not in wmgMap.keys():
                wmgMap[cand2] = dict()
                
            # Check which candidate is ranked above the other. Then assign 1 or -1 as appropriate.       
            if rankMap[cand1] < rankMap[cand2]:
                wmgMap[cand1][cand2] = 1
                wmgMap[cand2][cand1] = -1 
            elif rankMap[cand1] > rankMap[cand2]:
                wmgMap[cand1][cand2] = -1
                wmgMap[cand2][cand1] = 1

            # If the two candidates are tied, We make 0 the number of edges between them.
            elif rankMap[cand1] == rankMap[cand2]:
                wmgMap[cand1][cand2] = 0
                wmgMap[cand2][cand1] = 0

        return wmgMap