Added topological sorting to resource list