updated version. sort order is no longer reversed by dag.getSorted method
updated version. sort order is no longer reversed by dag.getSorted method