Single-link algorithm using the DB