graph finally sorted