private void depthFirstTraverse(NewDocumentType docType) {
        // Note that cycles are not allowed and detected earlier in DocumentGraphValidator.
        if (sortedTypes.containsKey(docType.getName())) {
            return;
        }
        for (NewDocumentType.Name referenceDocTypeName : docType.getDocumentReferences()) {
            NewDocumentType referenceDocType = unsortedTypes.get(referenceDocTypeName.getName());
            depthFirstTraverse(referenceDocType);
        }
        sortedTypes.put(docType.getName(), docType);
    }
Class that sorts a list of document types in topological order
according to the document references between the types.

Document types without any outgoing document references are considered
to be first in the topological order.

@author geirst
config-model/src/main/java/com/yahoo/vespa/model/content/TopologicalDocumentTypeSorter.java