compares peaks in temporal dimension and groups them