add Hamilton algorithm