def getWmg2(self, prefcounts, ordering, state, normalize=False):
        wmgMap = dict()
        for cand in state:
            wmgMap[cand] = dict()
        for cand1, cand2 in itertools.combinations(state, 2):
            wmgMap[cand1][cand2] = 0
            wmgMap[cand2][cand1] = 0
        for i in range(0, len(prefcounts)):
            for cand1, cand2 in itertools.combinations(ordering[i], 2):
                wmgMap[cand1][cand2] += prefcounts[i]
        if normalize == True:
            maxEdge = float('-inf')
            for cand in wmgMap.keys():
                maxEdge = max(maxEdge, max(wmgMap[cand].values()))
            for cand1 in wmgMap.keys():
                for cand2 in wmgMap[cand1].keys():
                    wmgMap[cand1][cand2] = float(wmgMap[cand1][cand2]) / maxEdge
        return wmgMap