Prune nodes not belonging to any edges.
431800
def prune(manager: Manager):
    """"""
    nodes_to_delete = [
        node
        for node in tqdm(manager.session.query(Node), total=manager.count_nodes())
        if not node.networks
    ]
    manager.session.delete(nodes_to_delete)
    manager.session.commit()
705480
def cull_nodes(self, stat, threshold=0.5, comparator=ge):
        
        comparator = self._lookup_comparator(comparator)
        dead = [
            name for name, node in self.node.items()
            if stat in node and comparator(node[stat], threshold)
        ]
        self.remove_nodes_from(dead)
        return self
158237
def remove_filtered_nodes(graph, node_predicates=None):
    
    nodes = list(filter_nodes(graph, node_predicates=node_predicates))
    graph.remove_nodes_from(nodes)
564268
def del_node(self, n):
        '''
        
        '''
        parent = self.get_node_attr(n, 'parent')
        if self.get_node_attr(n, 'direction') == 'R':
            self.set_node_attr(parent, 'Rchild', None)
        else:
            self.set_node_attr(parent, 'Lchild', None)
        Graph.del_node(self, n)
625513
private void pruneMatches() {
		int index = 0;
		while( index < matches.size ) {
			AssociatedTripleIndex a = matches.get(index);
			// not matched. Remove it from the list by copying that last element over it
			if( a.c == -1 ) {
				a.set(matches.get(matches.size-1));
				matches.size--;
			} else {
				index++;
			}
		}
	}
969713
private void trimNode(final Node node) {
        NodeList children = node.getChildNodes();
        for (int i = children.getLength() - 1; i >= 0; i--) {
            trimChild(node, children.item(i));
        }
    }
253873
public static void prune(List<Point3D_F64> cloud , int minNeighbors , double radius ) {
		if( minNeighbors < 0 )
			throw new IllegalArgumentException("minNeighbors must be >= 0");
		NearestNeighbor<Point3D_F64> nn = FactoryNearestNeighbor.kdtree(new KdTreePoint3D_F64() );
		NearestNeighbor.Search<Point3D_F64> search = nn.createSearch();

		nn.setPoints(cloud,false);
		FastQueue<NnData<Point3D_F64>> results = new FastQueue(NnData.class,true);

		// It will always find itself
		minNeighbors += 1;

		// distance is Euclidean squared
		radius *= radius;

		for( int i = cloud.size()-1; i >= 0; i-- ) {
			search.findNearest(cloud.get(i),radius,minNeighbors,results);

			if( results.size < minNeighbors ) {
				cloud.remove(i);
			}
		}
	}
377899
def dropnodes(edges):
    """"""
    newedges = []
    added = False
    for edge in edges:
        if bothnodes(edge):
            newtup = (edge[0][0], edge[1][0])
            newedges.append(newtup)
            added = True
        elif firstisnode(edge):
            for edge1 in edges:
                if edge[0] == edge1[1]:
                    newtup = (edge1[0], edge[1])
                    try:
                        newedges.index(newtup)
                    except ValueError as e:
                        newedges.append(newtup)
                    added = True
        elif secondisnode(edge):
            for edge1 in edges:
                if edge[1] == edge1[0]:
                    newtup = (edge[0], edge1[1])
                    try:
                        newedges.index(newtup)
                    except ValueError as e:
                        newedges.append(newtup)
                    added = True
        # gets the hanging nodes - nodes with no connection
        if not added:
            if firstisnode(edge):
                newedges.append((edge[0][0], edge[1]))
            if secondisnode(edge):
                newedges.append((edge[0], edge[1][0]))
        added = False
    return newedges
1020109
static SquareNode pickNot( SquareNode target , SquareNode child ) {
		for (int i = 0; i < 4; i++) {
			SquareEdge e = target.edges[i];
			if( e == null )
				continue;
			SquareNode c = e.destination(target);
			if( c != child )
				return c;
		}
		throw new RuntimeException("There was no odd one out some how");
	}
595408
def prune(self):
        
        self.boundprocs = [ obj for obj in self.boundprocs if obj.permission in self.display ]
        self.variables = [ obj for obj in self.variables if obj.permission in self.display ]
        for obj in self.boundprocs + self.variables:
            obj.visible = True
707877
def visit_emptynode(self, node, parent):
        """"""
        return nodes.EmptyNode(
            getattr(node, "lineno", None), getattr(node, "col_offset", None), parent
        )
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
503138
def _prune(self):
        """"""
        delkeys = [k for k in self.keys() if k not in self.__ringbuffer]
        for k in delkeys:  # necessary because dict is changed during iterations
            super(KRingbuffer,self).__delitem__(k)
62421
def filter_tree(tree):
    """"""
    to_remove = []
    for elem in tree.findall('urldata'):
        valid = elem.find('valid')
        if valid is not None and valid.text == '0' and \
           valid.attrib.get('result', '').startswith('401'):
            to_remove.append(elem)
    root = tree.getroot()
    for elem in to_remove:
        root.remove(elem)
588749
def _restrict(node, npoint, cache=None):
    """"""
    if node is BDDNODEZERO or node is BDDNODEONE:
        return node

    if cache is None:
        cache = dict()

    try:
        ret = cache[node]
    except KeyError:
        try:
            val = npoint[node.root]
        except KeyError:
            lo = _restrict(node.lo, npoint, cache)
            hi = _restrict(node.hi, npoint, cache)
            ret = _bddnode(node.root, lo, hi)
        else:
            child = {BDDNODEZERO: node.lo, BDDNODEONE: node.hi}[val]
            ret = _restrict(child, npoint, cache)
        cache[node] = ret
    return ret
923634
function (nodes) {
    var n = pickLinear(nodes);
    while (nodes.length > 0) {
      pickNext(nodes, n[0], n[1]);
    }
    return n;
  }
653061
def drop_nodes(self) -> None:
        """"""
        t = time.time()

        self.session.query(Node).delete()
        self.session.commit()

        log.info('dropped all nodes in %.2f seconds', time.time() - t)