Build a dictionary mapping each pair of nodes to a number (the distance between them).
        
        @type  graph: graph
        @param graph: Graph.

def optimize(self, graph):
        """
        Build a dictionary mapping each pair of nodes to a number (the distance between them).
        
        @type  graph: graph
        @param graph: Graph. 
        """        
        for center in self.centers:
            shortest_routes = shortest_path(graph, center)[1]
            for node, weight in list(shortest_routes.items()):
                self.nodes.setdefault(node, []).append(weight)