Availability The implementation of the first algorithm is available on request from the first author.