Cleans the dependency graph.

        This is achieved by performing a transitive reduction on the dependency
        graph and removing unused dependency ids from the graph (in that
        order).
486194
def clean_dependencies(self):
        
        def remove_tag(p_todo, p_tag, p_value):
            """
            Removes a tag from a todo item.
            """
            p_todo.remove_tag(p_tag, p_value)
            self.dirty = True

        def clean_parent_relations():
            """
            Remove id: tags for todos without child todo items.
            """

            for todo in [todo for todo in self._todos if todo.has_tag('id')]:
                value = todo.tag_value('id')
                if not self._depgraph.has_edge_id(value):
                    remove_tag(todo, 'id', value)
                    del self._parentdict[value]

        def clean_orphan_relations():
            """
            Remove p: tags for todos referring to a parent that is not in the
            dependency graph anymore.
            """

            for todo in [todo for todo in self._todos if todo.has_tag('p')]:
                for value in todo.tag_values('p'):
                    parent = self.todo_by_dep_id(value)

                    if not self._depgraph.has_edge(hash(parent), hash(todo)):
                        remove_tag(todo, 'p', value)

        self._depgraph.transitively_reduce()
        clean_parent_relations()
        clean_orphan_relations()
1317283
public void buildDependencyGraph(AbstractProject owner,DependencyGraph graph) {
        for (Object o : this) {
            if (o instanceof DependencyDeclarer) {
                DependencyDeclarer dd = (DependencyDeclarer) o;
                try {
                    dd.buildDependencyGraph(owner,graph);
                } catch (RuntimeException e) {
                    LOGGER.log(Level.SEVERE, "Failed to build dependency graph for " + owner,e);
                }
            }
        }
    }
575669
def resolve_dependency_graph(self, target):
        
        targets = self.deep_dependendants(target)
        # print "deep dependants:", targets
        return sorted(targets,
                      cmp=lambda a, b:
                          1 if b in self.deep_dependendants(a) else
                          -1 if a in self.deep_dependendants(b) else
                          0)
444789
def clear(self):
        
        self.adj.clear()
        self.node.clear()
        self.graph.clear()
842168
private void cleanup() {
        Entry<K, V>[] tab = this.table;

        for (int i = tab.length ; i-- > 0 ;) {
            for (Entry<K, V> e = tab[i], prev = null; e != null; e = e.next) {
                if (e.get() == null) {
                    // Clean up after a cleared Reference.
                    this.modCount++;
                    if (prev != null) {
                        prev.next = e.next;
                    } else {
                        tab[i] = e.next;
                    }
                    this.count--;
                } else {
                    prev = e;
                }
            }
        }
    }
868535
public void cleanup() {
    keys.cleanup();
    counts.cleanup();
    dictionary.cleanup();
    // Decrement the dictionary memory by the total size of all the elements
    memoryEstimate.decrementDictionaryMemory(SizeOf.SIZE_OF_LONG * numElements);
  }
1096115
def clear(self):
        
        self.reference = None
        self._pending_ref = None
        super(SimpleDependency, self).clear()
561417
def clear(self, keep_attrs=False):
        
        if not keep_attrs:
            for a in (self.graph_attr, self.node_attr, self.edge_attr):
                a.clear()
        del self.body[:]
723411
def remove(self, predicate=None, obj=None):
        
        self.graph.remove((self.asNode(), predicate, obj))
235247
function pruneGraphs(graph, graphOptions) {
  return currentGraph => {
    pruneRelatedBranches(graph, currentGraph, graphOptions);

    if (!graphOptions.isInsertOnly()) {
      pruneDeletedBranches(graph, currentGraph);
    }

    return currentGraph;
  };
}
1152978
def clear(self):
        
        self._logger.debug("Component handlers are cleared")

        # Clean up everything to avoid stale references, ...
        self._field = None
        self._name = None
        self._logger = None
380964
public function clean() {
    $this->logger->info('%name started.', ['%name' => get_class($this)]);

    $dataToRemove = $this->wrapper->getDataToRemove();
    foreach ($dataToRemove as $locationId => $locationData) {
      foreach ($locationData as $classId) {
        $this->mappingRepo->removeByLocationIdAndClassId($locationId, $classId);
      }
    }

    $this->logger->info('%name finished.', ['%name' => get_class($this)]);
  }
710859
def clear_masters(self):
        
        self.master_packages = Utils().remove_dbs(self.master_packages)
        for mas in self.master_packages:
            if mas in self.dependencies:
                self.master_packages.remove(mas)
896866
private void cleanUpLabels() {
        int id = 0;
        for (Iterator<Label> i = labels.iterator(); i.hasNext();) {
            Label label = i.next();
            if (label.isEmpty()) {
                i.remove();
            } else {
                label.compact();
                label.id = id++;
            }
        }
    }
986242
def delete_deps(self, conf, images):
        """"""
        for dependency_name, _ in conf.dependency_images():
            image = images[dependency_name]
            if image.deleteable_image:
                log.info("Removing un-needed image {0}".format(image.image_name))
                conf.harpoon.docker_api.remove_image(image.image_name)
986916
def _remove_unused_nodes(self):
        

        # Namespace shortcuts.
        nodes, wf_remove_node = self.nodes, self.workflow.remove_node
        add_visited, succ = self._visited.add, self.workflow.succ

        # Remove unused function and sub-dispatcher nodes.
        for n in (set(self._wf_pred) - set(self._visited)):
            node_type = nodes[n]['type']  # Node type.

            if node_type == 'data':
                continue  # Skip data node.

            if node_type == 'dispatcher' and succ[n]:
                add_visited(n)  # Add to visited nodes.
                i = self.index + nodes[n]['index']
                self.sub_sol[i]._remove_unused_nodes()
                continue  # Skip sub-dispatcher node with outputs.

            wf_remove_node(n)
1116879
private static Set<Artifact> getTransitiveDependencies(AbstractWisdomMojo mojo, DependencyGraphBuilder graph,
                                                           ArtifactFilter filter) {
        Set<Artifact> artifacts;
        artifacts = new LinkedHashSet<>();
        try {
            Set<Artifact> transitives = new LinkedHashSet<>();
            DependencyNode node = graph.buildDependencyGraph(mojo.project, filter);
            node.accept(new ArtifactVisitor(mojo, transitives));
            mojo.getLog().debug(transitives.size() + " transitive dependencies have been collected : " +
                    transitives);

            // Unfortunately, the retrieved artifacts are not resolved, we need to find their 'surrogates' in the
            // resolved list.
            Set<Artifact> resolved = mojo.project.getArtifacts();
            for (Artifact a : transitives) {
                Artifact r = getArtifact(a, resolved);
                if (r == null) {
                    mojo.getLog().warn("Cannot find resolved artifact for " + a);
                } else {
                    artifacts.add(r);
                }
            }
        } catch (DependencyGraphBuilderException e) {
            mojo.getLog().error("Cannot traverse the project's dependencies to collect transitive dependencies, " +
                    "ignoring transitive");
            mojo.getLog().debug("Here is the thrown exception having disabled the transitive dependency collection", e);
            artifacts = mojo.project.getDependencyArtifacts();
        }
        return artifacts;
    }