Added weighted sorting (TopoSortWeighted).