views:

57

answers:

1

My goal is to sort a designer.cs' InitializeComponent()'s statements for merging. I used coco-r to set up a dependency graph. This gives me certain conditions that need to be true.(If calling a method on an object make sure that the order of the methods if the same before and after the sort.)

I was curious if there are any sorting algorithms which would output a sorted list that would obey these conditions. The only thing I can think of is the brute forcing approach of moving items up by alphabetical order and checking conditions after each move. Then if the conditions no longer hold undo the last action and try moving the next item up.

+3  A: 

I think you're looking for a topological sort.

Keith Randall