docs: private static void buildInvertedDependencyGraph(IServiceManager manager, List<DependencyNode> roots,
  			List<Service> infraServices, List<Service> freeServices, Accessors accessors) {
  		final Map<Class<? extends Service>, DependencyNode> dependentServices = new TreeMap<>(Comparators.CLASS_COMPARATOR);
  		final Map<Class<? extends Service>, DependencyNode> rootServices = new TreeMap<>(Comparators.CLASS_COMPARATOR);
  
  		Service service;
  		for (final Entry<State, Service> entry : manager.servicesByState().entries()) {
  			if (accessors.matches(entry.getKey())) {
  				service = entry.getValue();
  				if (service instanceof InfrastructureService) {
  					infraServices.add(service);
  				} else if (service instanceof DependentService) {
  					final DependentService depServ = (DependentService) service;
  					final Class<? extends Service> type = depServ.getServiceType();
  					DependencyNode node = dependentServices.get(type);
  					boolean isRoot = true;
  					if (node == null) {
  						node = new DependencyNode(depServ, type);
  						dependentServices.put(type, node);
  					} else {
  						assert node.getService() == null;
  						node.setService(depServ);
  						isRoot = false;
  					}
  
  					Collection<Class<? extends Service>> deps = depServ.getServiceDependencies();
  					for (final Class<? extends Service> dep : deps) {
  						DependencyNode depNode = dependentServices.get(dep);
  						if (depNode == null) {
  							depNode = new DependencyNode(dep);
  							dependentServices.put(dep, depNode);
  						}
  						node.getNextServices().add(depNode);
  						rootServices.remove(depNode.getType());
  					}
  
  					deps = depServ.getServiceWeakDependencies();
  					for (final Class<? extends Service> dep : deps) {
  						DependencyNode depNode = dependentServices.get(dep);
  						if (depNode == null) {
  							depNode = new DependencyNode(dep);
  							dependentServices.put(dep, depNode);
  						}
  						node.getNextWeakServices().add(depNode);
  						rootServices.remove(depNode.getType());
  					}
  
  					if (isRoot) {
  						rootServices.put(type, node);
  					}
  				} else {
  					freeServices.add(service);
  				}
  			}
  		}
  
  		roots.addAll(rootServices.values());
  	}