code: private ResourceMap computeRelatedResources() {
  
          ResourceMap relatedResources = new ResourceMap();
          Set<CmsResource> resourcesToProcess = Sets.newHashSet(m_originalResources);
          Set<CmsResource> processedResources = Sets.newHashSet();
          while (!resourcesToProcess.isEmpty()) {
              CmsResource currentResource = resourcesToProcess.iterator().next();
              resourcesToProcess.remove(currentResource);
              processedResources.add(currentResource);
              if (!currentResource.getState().isDeleted()) {
                  Set<CmsResource> directlyRelatedResources = getDirectlyRelatedResources(currentResource);
                  for (CmsResource target : directlyRelatedResources) {
                      if (!processedResources.contains(target)) {
                          resourcesToProcess.add(target);
                      }
                      relatedResources.get(currentResource).add(target);
                  }
              }
          }
          return relatedResources;
      }
docs: Gets a ResourceMap which contains, for each resource reachable from the original set of resources, the directly related resources.<p>
  
  @return a map from resources to their directly related resources