sort so that mapParentsToMapChildren() has stability