Assigns data to this object and builds the Morse-Smale
            Complex
            @ In, X, an m-by-n array of values specifying m
            n-dimensional samples
            @ In, Y, a m vector of values specifying the output
            responses corresponding to the m samples specified by X
            @ In, w, an optional m vector of values specifying the
            weights associated to each of the m samples used. Default of
            None means all points will be equally weighted
            @ In, edges, an optional list of custom edges to use as a
            starting point for pruning, or in place of a computed graph.

def build(self, X, Y, w=None, edges=None):
        """ Assigns data to this object and builds the Morse-Smale
            Complex
            @ In, X, an m-by-n array of values specifying m
            n-dimensional samples
            @ In, Y, a m vector of values specifying the output
            responses corresponding to the m samples specified by X
            @ In, w, an optional m vector of values specifying the
            weights associated to each of the m samples used. Default of
            None means all points will be equally weighted
            @ In, edges, an optional list of custom edges to use as a
            starting point for pruning, or in place of a computed graph.
        """
        super(MorseComplex, self).build(X, Y, w, edges)

        if self.debug:
            sys.stdout.write("Decomposition: ")
            start = time.clock()

        morse_complex = MorseComplexFloat(
            vectorFloat(self.Xnorm.flatten()),
            vectorFloat(self.Y),
            str(self.gradient),
            str(self.simplification),
            vectorFloat(self.w),
            self.graph_rep.full_graph(),
            self.debug,
        )
        self.__amc = morse_complex

        self.persistences = []
        self.merge_sequence = {}
        morse_complex_json = json.loads(morse_complex.to_json())
        hierarchy = morse_complex_json["Hierarchy"]
        for merge in hierarchy:
            self.persistences.append(merge["Persistence"])
            self.merge_sequence[merge["Dying"]] = (
                merge["Persistence"],
                merge["Surviving"],
                merge["Saddle"],
            )
        self.persistences = sorted(list(set(self.persistences)))

        partitions = morse_complex_json["Partitions"]
        self.base_partitions = {}
        for i, label in enumerate(partitions):
            if label not in self.base_partitions:
                self.base_partitions[label] = []
            self.base_partitions[label].append(i)

        self.max_indices = list(self.base_partitions.keys())

        if self.debug:
            end = time.clock()
            sys.stdout.write("%f s\n" % (end - start))