Remove pathology nodes from the graph.
543480
def _remove_pathologies_oop(graph):
    """"""
    rv = graph.copy()
    victims = [
        node
        for node in rv
        if node[FUNCTION] == PATHOLOGY
    ]
    rv.remove_nodes_from(victims)
    return rv
1017012
def del_node(self, node):
        
        for each in list(self.incidents(node)):
            # Delete all the edges incident on this node
            self.del_edge((each, node))
            
        for each in list(self.neighbors(node)):
            # Delete all the edges pointing to this node.
            self.del_edge((node, each))
        
        # Remove this node from the neighbors and incidents tables   
        del(self.node_neighbors[node])
        del(self.node_incidence[node])
        
        # Remove any labeling which may exist.
        self.del_node_labeling( node )
250047
def remove_edges_from(self, ebunch):
        
        for e in ebunch:
            (u, v) = e[:2]
            if u in self.succ and v in self.succ[u]:
                del self.succ[u][v]
214253
def delete_location(self):
        
        # normally this should only remove one triple each
        for s, p, o in self._graph.triples((None, GEO_NS.lat, None)):
            self._graph.remove((s, p, o))
        for s, p, o in self._graph.triples((None, GEO_NS.long, None)):
            self._graph.remove((s, p, o))
61758
public void cleanDatabase() {
        lockingMechanism.writeLock().lock();
        try {
            for (ODocument edge : graph.browseEdges()) {
                edge.delete();
            }
            for (ODocument node : graph.browseVertices()) {
                node.delete();
            }
        } finally {
            lockingMechanism.writeLock().unlock();
        }
    }
1095372
def _prune(self):
        
        done = False
        while not done:
            done = True
            for node in [node for node in self.nodes.values() if node.intermediate]:
                if not [dep for dep in self.nodes.values() if dep.previous == node.volume]:
                    # logger.debug("Removing unnecessary node %s", node)
                    del self.nodes[node.volume]
                    done = False
86628
def _pathology_iterator(graph):
    
    for node in itt.chain.from_iterable(graph.edges()):
        if isinstance(node, Pathology):
            yield node
1056237
def remove_node(self, node):
        
        preds = self.reverse_edges.get(node, [])
        for pred in preds:
            self.edges[pred].remove(node)

        succs = self.edges.get(node, [])
        for suc in succs:
            self.reverse_edges[suc].remove(node)

        exc_preds = self.reverse_catch_edges.pop(node, [])
        for pred in exc_preds:
            self.catch_edges[pred].remove(node)

        exc_succs = self.catch_edges.pop(node, [])
        for suc in exc_succs:
            self.reverse_catch_edges[suc].remove(node)

        self.nodes.remove(node)
        if node in self.rpo:
            self.rpo.remove(node)
        del node
1339879
static void removeEntityGraphs(Map<String, Object> queryHints) {
    if (queryHints == null) {
      return;
    }
    queryHints.remove(EntityGraph.EntityGraphType.FETCH.getKey());
    queryHints.remove(EntityGraph.EntityGraphType.LOAD.getKey());
  }
19330
def cleanup(self):
        
        plots = self.traverse(lambda x: x, [BokehPlot])
        for plot in plots:
            if not isinstance(plot, (GenericCompositePlot, GenericElementPlot, GenericOverlayPlot)):
                continue
            streams = list(plot.streams)
            plot.streams = []
            plot._document = None

            if plot.subplots:
                plot.subplots.clear()

            if isinstance(plot, GenericElementPlot):
                for callback in plot.callbacks:
                    streams += callback.streams
                    callback.cleanup()

            for stream in set(streams):
                stream._subscribers = [
                    (p, subscriber) for p, subscriber in stream._subscribers
                    if get_method_owner(subscriber) not in plots
                ]

        if self.comm and self.root is self.handles.get('plot'):
            self.comm.close()
1316160
def disconnect_all(self):
        
        rhs = 'b:' + self.definition['node_class'].__label__
        rel = _rel_helper(lhs='a', rhs=rhs, ident='r', **self.definition)
        q = 'MATCH (a) WHERE id(a)={self} MATCH ' + rel + ' DELETE r'
        self.source.cypher(q)
189022
def prune_graph(graph_str, package_name):
    
    # find nodes of interest
    g = read_dot(graph_str)
    nodes = set()

    for node, attrs in g.node_attr.iteritems():
        attr = [x for x in attrs if x[0] == "label"]
        if attr:
            label = attr[0][1]
            try:
                req_str = _request_from_label(label)
                request = PackageRequest(req_str)
            except PackageRequestError:
                continue

            if request.name == package_name:
                nodes.add(node)

    if not nodes:
        raise ValueError("The package %r does not appear in the graph."
                         % package_name)

    # find nodes upstream from these nodes
    g_rev = g.reverse()
    accessible_nodes = set()
    access = accessibility(g_rev)
    for node in nodes:
        nodes_ = access.get(node, [])
        accessible_nodes |= set(nodes_)

    # remove inaccessible nodes
    inaccessible_nodes = set(g.nodes()) - accessible_nodes
    for node in inaccessible_nodes:
        g.del_node(node)

    return write_dot(g)
1144207
def remove_irrelevant_nodes(frame, options, total_time=None):
    '''
    
    '''
    if frame is None:
        return None
    
    if total_time is None:
        total_time = frame.time()

    filter_threshold = options.get('filter_threshold', 0.01)

    for child in frame.children:
        proportion_of_total = child.time() / total_time

        if proportion_of_total < filter_threshold:
            frame.self_time += child.time()
            child.remove_from_parent()
        
    for child in frame.children:
        remove_irrelevant_nodes(child, options=options, total_time=total_time)

    return frame
827131
def remove_node_attributes(G: nx.DiGraph, attributes: Union[str, Iterable[str]]):
    
    G = G.copy()
    for _, data in G.nodes(data=True):
        for attribute in setwrap(attributes):
            if attribute in data:
                del data[attribute]
    return G
653683
def _clean(self):
        """"""
        found_ids = {}
        nodes = [self._nodes[_node.Root.ID]]
        while nodes:
            node = nodes.pop()
            found_ids[node.id] = None
            nodes = nodes + node.children

        for node_id in self._nodes:
            if node_id in found_ids:
                continue
            logger.error('Dangling node: %s', node_id)

        for node_id in found_ids:
            if node_id in self._nodes:
                continue
            logger.error('Unregistered node: %s', node_id)
100153
def del_node(self, node):
        
        if self.has_node(node):
            for e in self.node_links[node]:
                self.edge_links[e].remove(node)

            self.node_links.pop(node)
            self.graph.del_node((node,'n'))
943592
def clear_graph(identifier=None):
    
    graph = get_graph()
    if identifier:
        graph.destroy(identifier)
    try:
        graph.close()
    except:
        warn("Unable to close the Graph")