Returns a MinimizedCondition that represents the condition node after
minimization.
10537
static MinimizedCondition fromConditionNode(Node n) {
    checkState(n.getParent() != null);
    switch (n.getToken()) {
      case NOT:
      case AND:
      case OR:
      case HOOK:
      case COMMA:
        return computeMinimizedCondition(n);
      default:
        return unoptimized(n);
    }
  }
90717
def optimize(self):
        """"""
        subpattern = None
        if (self.content is not None and
            len(self.content) == 1 and len(self.content[0]) == 1):
            subpattern = self.content[0][0]
        if self.min == 1 and self.max == 1:
            if self.content is None:
                return NodePattern(name=self.name)
            if subpattern is not None and  self.name == subpattern.name:
                return subpattern.optimize()
        if (self.min <= 1 and isinstance(subpattern, WildcardPattern) and
            subpattern.min <= 1 and self.name == subpattern.name):
            return WildcardPattern(subpattern.content,
                                   self.min*subpattern.min,
                                   self.max*subpattern.max,
                                   subpattern.name)
        return self
575484
private static <T> Optional<T> lowestCommonAncestor(TreeDef.Parented<T> treeDef, T nodeA, T nodeB) {
		class TreeSearcher {
			private T tip;
			private final Set<T> visited;

			public TreeSearcher(T start) {
				this.tip = start;
				this.visited = new HashSet<>();
			}

			public boolean hasMore() {
				return tip != null;
			}

			public Optional<T> march(TreeSearcher other) {
				if (other.visited.contains(tip)) {
					return Optional.of(tip);
				} else {
					visited.add(tip);
					tip = treeDef.parentOf(tip);
					return Optional.empty();
				}
			}
		}

		// make a list of a's parents (bottom of stack is 'a' itself, top of is root)
		TreeSearcher searchA = new TreeSearcher(nodeA);
		TreeSearcher searchB = new TreeSearcher(nodeB);

		Optional<T> commonAncestor = searchB.march(searchA);
		// so long as both searches
		while (searchA.hasMore() && searchB.hasMore()) {
			commonAncestor = searchA.march(searchB);
			if (commonAncestor.isPresent()) {
				return commonAncestor;
			}
			commonAncestor = searchB.march(searchA);
			if (commonAncestor.isPresent()) {
				return commonAncestor;
			}
		}
		while (searchA.hasMore() && !commonAncestor.isPresent()) {
			commonAncestor = searchA.march(searchB);
		}
		while (searchB.hasMore() && !commonAncestor.isPresent()) {
			commonAncestor = searchB.march(searchA);
		}
		return commonAncestor;
	}
724004
public BoundedAssertion getMin()
    {
    ICondition min = null;
    Iterator<ICondition> conditions = getConditions();
    for( int i = 0; i < 1; i++) min = conditions.next();
    return (BoundedAssertion) min;
    }
683678
def minimize(self, element: Expression[z3.ExprRef]) -> None:
        
        self.raw.minimize(element.raw)
427001
@SafeVarargs
	public static <T> Optional<T> lowestCommonAncestor(TreeDef.Parented<T> treeDef, T... nodes) {
		return lowestCommonAncestor(treeDef, Arrays.asList(nodes));
	}
427986
private Node tryMinimizeCondition(Node n) {
    n = performConditionSubstitutions(n);
    MinimizedCondition minCond = MinimizedCondition.fromConditionNode(n);
    return replaceNode(
        n,
        minCond.getMinimized(MinimizationStyle.PREFER_UNNEGATED));
  }
1187335
def reduce_min(attrs, inputs, proto_obj):
    """"""
    new_attrs = translation_utils._fix_attribute_names(attrs, {'axes':'axis'})
    return 'min', new_attrs, inputs
94898
def get_minimum(self):
        '''
        
        '''
        return (self._min_value_t1, self._min_value_t2,
                self._min_value,    self._min_value_data)
313317
def closest_value(root, target):
    
    a = root.val
    kid = root.left if target < a else root.right
    if not kid:
        return a
    b = closest_value(kid, target)
    return min((a,b), key=lambda x: abs(target-x))
1027165
private static int min(int a, int b, int c) {
        int r = a;
        if (r > b) r = b;
        if (r > c) r = c;
        return r;
    }
12591
function () {
            var node;
            if (!this.collapsed) {
                var range = this.cloneRange().adjustmentBoundary().shrinkBoundary();
                if (selectOneNode(range)) {
                    var child = range.startContainer.childNodes[range.startOffset];
                    if (child && child.nodeType == 1 && (dtd.$empty[child.tagName] || dtd.$nonChild[child.tagName])) {
                        node = child;
                    }
                }
            }
            return node;
        }
329557
function SMALLER(tree, n, m) {
		return tree[n].fc < tree[m].fc || (tree[n].fc === tree[m].fc && depth[n] <= depth[m]);
	}
47712
static int getNodeRangeLow(int nodeOrder) {
        int level = getLevelOfNode(nodeOrder);
        int leftMostLeafOrder = getLeftMostNodeOrderOnLevel(level);
        int levelHashStep = (int) getNodeHashRangeOnLevel(level);
        int leafOrderOnLevel = nodeOrder - leftMostLeafOrder;

        return Integer.MIN_VALUE + (leafOrderOnLevel * levelHashStep);
    }
1085312
def X_less(self):
        """"""
        self.parent.value('window_length',
                          self.parent.value('window_length') / 2)
        self.parent.overview.update_position()
108522
def _min(self, memory, addr, **kwargs):
        
        return memory.state.solver.min(addr, exact=kwargs.pop('exact', self._exact), **kwargs)
472658
def get_minimal_subgraph(g, nodes):
    
    logging.info("Slimming {} to {}".format(g,nodes))
    # maps ancestor nodes to members of the focus node set they subsume
    mm = {}
    subnodes = set()
    for n in nodes:
        subnodes.add(n)
        ancs = nx.ancestors(g, n)
        ancs.add(n)
        for a in ancs:
            subnodes.add(a)
            if a not in mm:
                mm[a] = set()
            mm[a].add(n)

    # merge graph
    egraph = nx.MultiDiGraph()

    # TODO: ensure edge labels are preserved
    for a, aset in mm.items():
        for p in g.predecessors(a):
            logging.info(" cmp {} -> {} // {} {}".format(len(aset),len(mm[p]), a, p))
            if p in mm and len(aset) == len(mm[p]):
                egraph.add_edge(p, a)
                egraph.add_edge(a, p)
                logging.info("will merge {} <-> {} (members identical)".format(p,a))

    nmap = {}
    leafmap = {}
    disposable = set()
    for cliq in nx.strongly_connected_components(egraph):
        leaders = set()
        leafs = set()
        for n in cliq:
            is_src = False
            if n in nodes:
                logging.info("Preserving: {} in {}".format(n,cliq))
                leaders.add(n)
                is_src = True
                
            is_leaf = True
            for p in g.successors(n):
                if p in cliq:
                    is_leaf = False

            if not(is_leaf or is_src):
                disposable.add(n)
                
            if is_leaf:
                logging.info("Clique leaf: {} in {}".format(n,cliq))
                leafs.add(n)

                
        leader = None
        if len(leaders) > 1:
            logging.info("UHOH: {}".format(leaders))
        if len(leaders) > 0:
            leader = list(leaders)[0]
        else:
            leader = list(leafs)[0]
        leafmap[n] = leafs

    subg = g.subgraph(subnodes)
    fg = remove_nodes(subg, disposable)
    return fg