Great Deluge algorithm