copy the solution into
topologicalsort
copy(*pn,topologicalsort,ranking);