1. A method for ordering parameters in a graph-based computation including: determining, by a processor, a desired first ordering of a set of parameters associated with graph elements in a computation graph; determining, by the processor, an ordering constraint for the set of parameters; and determining, by the processor, a second ordering of the set of parameters that satisfies the ordering constraint according to the desired first ordering; wherein determining the second ordering includes, for each of multiple constrained parameters in the set, associating with the constrained parameter one or more other parameters that constrain the order of the constrained parameter in the second ordering according to the ordering constraint, and for each of multiple iterations, selecting different subsets of one or more parameters in the set to be assigned positions in the second ordering based at least in part on how many other parameters are associated with a given parameter in the subset.