/*
The subroutine of DFS.
772676
private void dfsVisit(DirectedGraph<V, E> visitedGraph, VertexNumber<V> v) 
    {	
    	 VertexNumber<V> w;
    	 stack.add(v);
    	 B.add(v.setNumber(stack.size() - 1));
    	
         // follow all edges
         for (E edge : visitedGraph.outgoingEdgesOf(v.getVertex())) {
        	 
        	 w =  vertexToVertexNumber.get(visitedGraph.getEdgeTarget(edge));

             if (w.getNumber() == 0) {
            	 dfsVisit(graph, w);
             }
             else { /*contract if necessary*/
            	 while (w.getNumber() < B.getLast()) 
            		 B.removeLast(); 
             } 
         }
         
         ImmutableSet.Builder<V> L = new ImmutableSet.Builder<>(); 
         if (v.getNumber() == (B.getLast())) { 
        	 /* number vertices of the next strong component */
        	 B.removeLast(); 
              
             c++;
             while (v.getNumber() <= (stack.size()-1)) {
            	 VertexNumber<V> r = stack.removeLast();
                 L.add(r.getVertex()); 
                 r.setNumber(c);
             } 
             stronglyConnectedSets.add(new Equivalences<V>(L.build())); 
         } 
    }
882340
private function _filesystems()
    {
        $notwas = true;
        if (CommonFunctions::executeProgram('df', '2>/dev/null ', $df, PSI_DEBUG) && preg_match("/\s+[0-9\.]+[KMGT]\s+/", $df)) {
            $df = preg_split("/\n/", $df, -1, PREG_SPLIT_NO_EMPTY);
            if (CommonFunctions::executeProgram('mount', '', $mount, PSI_DEBUG)) {
                $mount = preg_split("/\n/", $mount, -1, PREG_SPLIT_NO_EMPTY);
                foreach ($mount as $mount_line) {
                    $mount_buf = preg_split('/\s+/', $mount_line);
                    if (count($mount_buf) == 6) {
                        $mount_parm[$mount_buf[1]]['fstype'] = $mount_buf[2];
                        if (PSI_SHOW_MOUNT_OPTION) $mount_parm[$mount_buf[1]]['options'] = $mount_buf[3];
                        $mount_parm[$mount_buf[1]]['mountdev'] = $mount_buf[0];
                    }
                }
                foreach ($df as $df_line) {
                    if ((preg_match("/^(\/\S+)(\s+)(([0-9\.]+)([KMGT])(\s+)([0-9\.]+)([KMGT])(\s+)([0-9\.]+)([KMGT])(\s+))/", $df_line, $df_buf)
                         || preg_match("/^(\/[^\s\:]+)\:(\s+)(([0-9\.]+)([KMGT])(\s+total\,\s+)([0-9\.]+)([KMGT])(\s+used\,\s+)([0-9\.]+)([KMGT])(\s+available))/", $df_line, $df_buf))
                         && !preg_match('/^\/mnt\/asec\/com\./', $df_buf[1])) {
                        $dev = new DiskDevice();
                        if (PSI_SHOW_MOUNT_POINT) $dev->setMountPoint($df_buf[1]);

                        if ($df_buf[5] == 'K') $dev->setTotal($df_buf[4] * 1024);
                        elseif ($df_buf[5] == 'M') $dev->setTotal($df_buf[4] * 1024*1024);
                        elseif ($df_buf[5] == 'G') $dev->setTotal($df_buf[4] * 1024*1024*1024);
                        elseif ($df_buf[5] == 'T') $dev->setTotal($df_buf[4] * 1024*1024*1024*1024);

                        if ($df_buf[8] == 'K') $dev->setUsed($df_buf[7] * 1024);
                        elseif ($df_buf[8] == 'M') $dev->setUsed($df_buf[7] * 1024*1024);
                        elseif ($df_buf[8] == 'G') $dev->setUsed($df_buf[7] * 1024*1024*1024);
                        elseif ($df_buf[8] == 'T') $dev->setUsed($df_buf[7] * 1024*1024*1024*1024);

                        if ($df_buf[11] == 'K') $dev->setFree($df_buf[10] * 1024);
                        elseif ($df_buf[11] == 'M') $dev->setFree($df_buf[10] * 1024*1024);
                        elseif ($df_buf[11] == 'G') $dev->setFree($df_buf[10] * 1024*1024*1024);
                        elseif ($df_buf[11] == 'T') $dev->setFree($df_buf[10] * 1024*1024*1024*1024);

                        if (isset($mount_parm[$df_buf[1]])) {
                            $dev->setFsType($mount_parm[$df_buf[1]]['fstype']);
                            $dev->setName($mount_parm[$df_buf[1]]['mountdev']);

                            if (PSI_SHOW_MOUNT_OPTION) {
                                if (PSI_SHOW_MOUNT_CREDENTIALS) {
                                    $dev->setOptions($mount_parm[$df_buf[1]]['options']);
                                } else {
                                    $mpo=$mount_parm[$df_buf[1]]['options'];

                                    $mpo=preg_replace('/(^guest,)|(^guest$)|(,guest$)/i', '', $mpo);
                                    $mpo=preg_replace('/,guest,/i', ',', $mpo);

                                    $mpo=preg_replace('/(^user=[^,]*,)|(^user=[^,]*$)|(,user=[^,]*$)/i', '', $mpo);
                                    $mpo=preg_replace('/,user=[^,]*,/i', ',', $mpo);

                                    $mpo=preg_replace('/(^username=[^,]*,)|(^username=[^,]*$)|(,username=[^,]*$)/i', '', $mpo);
                                    $mpo=preg_replace('/,username=[^,]*,/i', ',', $mpo);

                                    $mpo=preg_replace('/(^password=[^,]*,)|(^password=[^,]*$)|(,password=[^,]*$)/i', '', $mpo);
                                    $mpo=preg_replace('/,password=[^,]*,/i', ',', $mpo);

                                    $dev->setOptions($mpo);
                                }
                            }
                        }
                        $this->sys->setDiskDevices($dev);
                        $notwas = false;
                    }
                }
            }
        }
        if ($notwas) { // try Linux df style
            $arrResult = Parser::df("-P 2>/dev/null", false);
            foreach ($arrResult as $dev) {
                $this->sys->setDiskDevices($dev);
            }
        }
    }
235014
def __setup_dfs_data(graph, adj):
    """"""
    dfs_data = __get_dfs_data(graph, adj)

    dfs_data['graph'] = graph
    dfs_data['adj'] = adj

    L1, L2 = __low_point_dfs(dfs_data)
    dfs_data['lowpoint_1_lookup'] = L1
    dfs_data['lowpoint_2_lookup'] = L2

    edge_weights = __calculate_edge_weights(dfs_data)
    dfs_data['edge_weights'] = edge_weights

    return dfs_data
919201
private ValFrame scalar_op_frame(final double d, Frame fr) {
    Frame res = new MRTask() {
      @Override
      public void map(Chunk[] chks, NewChunk[] cress) {
        for (int c = 0; c < chks.length; c++) {
          Chunk chk = chks[c];
          NewChunk cres = cress[c];
          for (int i = 0; i < chk._len; i++)
            cres.addNum(op(d, chk.atd(i)));
        }
      }
    }.doAll(fr.numCols(), Vec.T_NUM, fr).outputFrame(fr._names, null);
    return cleanCategorical(fr, res); // Cleanup categorical misuse
  }
568755
def subCell2DCoords(*args, **kwargs):
    '''
    '''
    for _, _, s0, s1 in subCell2DSlices(*args, **kwargs):
        yield ((s1.start, s1.start, s1.stop),
               (s0.start, s0.stop,  s0.stop))
364492
function(o, callback) {
      for (var i in o) {
        callback.call(o, i, o[i]);

        if (Prism.util.type(o) === 'Object') {
          Prism.languages.DFS(o[i], callback);
        }
      }
    }
578644
def _dfs(self, visited):
        
        if self not in visited:
            visited.add(self)
            for successor in self._children + self._followOns:
                successor._dfs(visited)
635218
def _L(dfs_data):
    """L(T) = {v | the first w in Adj[v] corresponds to a frond vw}."""
    node_set = set()
    for v, adj in list(dfs_data['adj'].items()):
        w = adj[0]
        if is_frond(v, w, dfs_data):
            node_set.add(v)
    return list(node_set)
1166460
def __calculate_bu_dfs_recursively(u, b, dfs_data):
    """"""
    first_time = True
    for v in dfs_data['adj'][u]:
        if a(v, dfs_data) == u:
            if first_time:
                b[v] = b[u]
            else:
                b[v] = D(u, dfs_data)
            __calculate_bu_dfs_recursively(v, b, dfs_data)
        first_time = False
56294
public static List<SubGraph> getSubgraphsMatching(SameDiff sd, SubGraphPredicate p) {
        List<SubGraph> out = new ArrayList<>();
        for (DifferentialFunction df : sd.functions()) {
            if (p.matches(sd, df)) {
                SubGraph sg = p.getSubGraph(sd, df);
                out.add(sg);
            }
        }

        return out;
    }
729868
def _dfs(vertex, vertices_neighbours):
    
    visited = set()
    to_visit = deque([vertex])
    while to_visit:
        vertex = to_visit.pop()
        if vertex not in visited:
            yield vertex
            visited.add(vertex)
            to_visit.extend(vertices_neighbours[vertex])
70764
function rf(df1, df2) {
      var rchisqRatio;

      rchisqRatio = function(d) { return chisq.rchisq(d)() / d; };

      if (df1 <= 0 || df2 <= 0) { return function() { return NaN; }; }

      return function() {
         return rchisqRatio(df1) / rchisqRatio(df2);
      };
   }
713236
def dfs(graph, func, head, reverse=None):
    
    todo = deque()
    todo.append(head)
    path = deque()
    done = set()
    while todo:
        node = todo.popleft()
        if node in done:
            path.pop()
            continue

        done.add(node)
        path.append(node)
        result = func(node, path, graph)
        if result:
            if reverse:
                children = graph.get_parents(node)
            else:
                children = graph.get_children(node)
            todo.extend(children)
294876
private void dfs(Visitor visitor, int v, int[] cc, int id) {
        visitor.visit(v);
        cc[v] = id;
        for (Edge edge : graph[v]) {
            int t = edge.v2;
            if (!digraph && t == v) {
                t = edge.v1;
            }

            if (cc[t] == -1) {
                dfs(visitor, t, cc, id);
            }
        }
    }
669703
function (f, d) {

        f = makeCompareFunction(f, d);
        f.thenBy = tb;
        return f;
    }
760154
def __insert_frond_LF(d_w, d_u, dfs_data):
    """"""
    # --Add the frond to the left side
    dfs_data['LF'].append( (d_w, d_u) )
    dfs_data['FG']['l'] += 1

    dfs_data['last_inserted_side'] = 'LF'
1079350
function aroundBuildOutputDataArray(Sb $sb, \Closure $f, $object, $type) {
		$result = $f($object, $type); /** @var array(string => mixed) $result */
		if ($object instanceof DC) {
			$result += df_clean([Schema::F__DF => df_api_object_get($object, Schema::F__DF)]);
		}
		return $result;
	}