'Pre-calculate node placement'

def calculatePlacement(self):

    placement = {}
    switchFor = {}
    for (src, dst) in self.links:
        if ((src in self.hset) and (dst in self.sset)):
            switchFor[src] = dst
        if ((dst in self.hset) and (src in self.sset)):
            switchFor[dst] = src
    placement = self.bin(self.switches, self.servers)
    placement.update(self.bin(self.controllers, self.servers))
    for h in self.hosts:
        if (h in placement):
            continue
        if (h in switchFor):
            placement[h] = placement[switchFor[h]]
        else:
            raise Exception(('SwitchBinPlacer:    cannot    place    isolated    host    ' + h))
    return placement
