code: def order (self, objects):
          
          # The algorithm used is the same is standard transitive closure,
          # except that we're not keeping in-degree for all vertices, but
          # rather removing edges.
          result = []
  
          if not objects:
              return result
  
          constraints = self.__eliminate_unused_constraits (objects)
  
          # Find some library that nobody depends upon and add it to
          # the 'result' array.
          obj = None
          while objects:
              new_objects = []
              while objects:
                  obj = objects [0]
  
                  if self.__has_no_dependents (obj, constraints):
                      # Emulate break ;
                      new_objects.extend (objects [1:])
                      objects = []
  
                  else:
                      new_objects.append (obj)
                      obj = None
                      objects = objects [1:]
  
              if not obj:
                  raise BaseException ("Circular order dependencies")
  
              # No problem with placing first.
              result.append (obj)
  
              # Remove all containts where 'obj' comes first,
              # since they are already satisfied.
              constraints = self.__remove_satisfied (constraints, obj)
  
              # Add the remaining objects for further processing
              # on the next iteration
              objects = new_objects
  
          return result
docs: Given a list of objects, reorder them so that the constains specified
              by 'add_pair' are satisfied.
  
              The algorithm was adopted from an awk script by Nikita Youshchenko
              (yoush at cs dot msu dot su)