code: private void prepareGraph() throws IllegalStateException {
          List<ResourceType<L>> disabledTypes = new ArrayList<>();
  
          // flattened list of types, all sets are collapsed into one
          Map<Name, ResourceType<L>> allResourceTypes = new HashMap<>();
  
          // add all resource types as vertices in the graph
          for (TypeSet<ResourceType<L>> rTypeSet : typeSetMap.values()) {
              for (ResourceType<L> rType : rTypeSet.getTypeMap().values()) {
                  if (null != allResourceTypes.put(rType.getName(), rType)) {
                      throw new IllegalStateException("Multiple resource types have the same name: " + rType.getName());
                  }
                  resourceTypesGraph.addVertex(rType);
  
                  if (!rTypeSet.isEnabled()) {
                      disabledTypes.add(rType);
                  }
              }
          }
  
          // now add the parent hierarchy to the graph
          for (TypeSet<ResourceType<L>> rTypeSet : typeSetMap.values()) {
              for (ResourceType<L> rType : rTypeSet.getTypeMap().values()) {
                  for (Name parent : rType.getParents()) {
                      ResourceType<L> parentResourceType = allResourceTypes.get(parent);
                      if (parentResourceType == null) {
                          log.debugf("Resource type [%s] will ignore unknown parent [%s]", rType.getName(), parent);
                      } else {
                          resourceTypesGraph.addEdge(parentResourceType, rType);
                      }
                  }
              }
          }
  
          // now strip all disabled types - if a type has an ancestor that is disabled, it too will be disabled
          List<ResourceType<L>> toBeDisabled = new ArrayList<>();
          for (ResourceType<L> disabledType : disabledTypes) {
              toBeDisabled.add(disabledType);
              getDeepChildrenList(disabledType, toBeDisabled);
              log.infoDisablingResourceTypes(disabledType, toBeDisabled);
          }
          resourceTypesGraph.removeAllVertices(toBeDisabled);
      }
docs: Prepares the graph.
  
  @throws IllegalStateException if there are missing types