Returns a new DAG with only the given nodes and their
        dependencies.

        Args:
            nodes (list): The nodes you are interested in.

        Returns:
            :class:`stacker.dag.DAG`: The filtered graph.
553937
def filter(self, nodes):
        

        filtered_dag = DAG()

        # Add only the nodes we need.
        for node in nodes:
            filtered_dag.add_node_if_not_exists(node)
            for edge in self.all_downstreams(node):
                filtered_dag.add_node_if_not_exists(edge)

        # Now, rebuild the graph for each node that's present.
        for node, edges in self.graph.items():
            if node in filtered_dag.graph:
                filtered_dag.graph[node] = edges

        return filtered_dag
103127
def start(self, nodes=None):
        
        if not self.is_connected():
            return None

        nodes = nodes or self.nodes
        result = []

        for node in nodes:
            if node.state == 'running':
                logging.warning('Node %s is already "running".', node.name)
                continue
            try:
                status = self.gce.ex_start_node(node)
                if status:
                    result.append(node)
            except InvalidRequestError as err:
                raise ComputeEngineManagerException(err)

        return result
249132
def nodes(self):
        
        resource = sub_collection(
            self.get_relation('vss_container_node'), 
            VSSContainerNode) 
        resource._load_from_engine(self, 'nodes') 
        return resource
950545
def get_dependency_graph(component):
    
    if component not in DEPENDENCIES:
        raise Exception("%s is not a registered component." % get_name(component))

    if not DEPENDENCIES[component]:
        return {component: set()}

    graph = defaultdict(set)

    def visitor(c, parent):
        if parent is not None:
            graph[parent].add(c)

    walk_dependencies(component, visitor)

    graph = dict(graph)

    # Find all items that don't depend on anything.
    extra_items_in_deps = _reduce(set.union, graph.values(), set()) - set(graph.keys())

    # Add empty dependencies where needed.
    graph.update(dict((item, set()) for item in extra_items_in_deps))

    return graph
855638
def filter_nodes(graph: BELGraph, node_predicates: NodePredicates) -> Iterable[BaseEntity]:
    """"""
    concatenated_predicate = concatenate_node_predicates(node_predicates=node_predicates)
    for node in graph:
        if concatenated_predicate(graph, node):
            yield node
1004493
def remove_isolated_nodes_op(graph):
    
    rv = graph.copy()
    nodes = list(nx.isolates(rv))
    rv.remove_nodes_from(nodes)
    return rv
585066
def get_plan(self, nodes=None):
        
        if nodes:
            plan = self.graph.resolve_nodes(nodes)
        else:
            plan = self.graph.resolve_node()

        return plan
713482
def _filter_nodes(superclass, all_nodes=_all_nodes):
    """"""
    node_names = (node.__name__ for node in all_nodes
                  if issubclass(node, superclass))
    return frozenset(node_names)
81373
def nodes(self, node=None):
        ''''''
        if node is None:
            for root in self.stack:
                yield from self.nodes(root)
        else:
            yield node
            if node.is_container():
                for child in node.children:
                    yield from self.nodes(child)
683126
def filterGraph(graph, node_fnc):
		
		nodes = filter(lambda l: node_fnc(l), graph.nodes())
		edges = {}

		gedges = graph.edges()
		for u in gedges:
			if u not in nodes:
				continue
			for v in gedges[u]:
				if v not in nodes:
					continue
				try:
					edges[u].append(v)
				except KeyError:
					edges[u] = [v]

		return Graph(nodes, edges)
1294484
def ind_nodes(self):
        
        graph = self.graph

        dependent_nodes = set(
            node for dependents
            in graph.values() for node in dependents)
        return [node_ for node_ in graph if node_ not in dependent_nodes]
852640
def _nodes(self, tree):
        
        def recourse(temp_tree_, nodes):
            if isinstance(temp_tree_, dict):
                if temp_tree_['split'] != -1:
                    nodes.append(temp_tree_['node'])
                    if temp_tree_['split'] != -1:
                        for k in ['sl', 'sr']:
                            recourse(temp_tree_[k], nodes)
            return None

        nodes_ = []
        recourse(tree, nodes_)
        return nodes_
1061671
def getRequiredNodes(self):
        
        return {nodeShape:len(self.nodeReservations[nodeShape]) for nodeShape in self.nodeShapes}
564375
def create_dep_usage_graph(self, targets):
    
    with self.invalidated(targets,
                          invalidate_dependents=True) as invalidation_check:
      target_to_vts = {}
      for vts in invalidation_check.all_vts:
        target_to_vts[vts.target] = vts

      if not self.get_options().use_cached:
        node_creator = self.calculating_node_creator(
          self.context.products.get_data('classes_by_source'),
          self.context.products.get_data('runtime_classpath'),
          self.context.products.get_data('product_deps_by_src'),
          target_to_vts)
      else:
        node_creator = self.cached_node_creator(target_to_vts)

      return DependencyUsageGraph(self.create_dep_usage_nodes(targets, node_creator),
                                  self.size_estimators[self.get_options().size_estimator])
186455
def read(self, nodes=None, **kwargs):
        
        if nodes is None:
            required_nodes = self.wishlist - set(self.datasets.keys())
            nodes = self.dep_tree.leaves(nodes=required_nodes)
        return self._read_datasets(nodes, **kwargs)
781745
def get_all_nodes(self):
        
        nodes = self.nodes.values()
        if nodes:
            return reduce(operator.add, nodes, list())
        else:
            return []
1349319
public Graph<Node> dependenceGraph() {
        Graph.Builder<Node> builder = new Graph.Builder<>();

        archives().stream()
            .map(analyzer.results::get)
            .filter(deps -> !deps.dependencies().isEmpty())
            .flatMap(deps -> deps.dependencies().stream())
            .forEach(d -> addEdge(builder, d));
        return builder.build();
    }