GroupGraph: simplify function _regroup.