Groups nodes by a second field