Ward method, class average method, minimum distance method, maximum distance method and so on are really unclear. Please search for cluster analysis. There are many methods, which I can't finish here, and I don't know what language you are programming in.