An algorithm for pattern description on the level of relative proximity