Eager-compatible Graph().as_default() yielding the graph.
493279
def maybe_with_graph(graph=None, create_if_none=True):
  """"""
  if tf.executing_eagerly():
    yield None
  else:
    if graph is None and create_if_none:
      graph = tf.Graph()

    if graph is None:
      yield None
    else:
      with graph.as_default():
        yield graph
638648
public <NV> Graph<K, VV, NV> mapEdges(final MapFunction<Edge<K, EV>, NV> mapper, TypeInformation<Edge<K, NV>> returnType) {
		DataSet<Edge<K, NV>> mappedEdges = edges.map(
			new MapFunction<Edge<K, EV>, Edge<K, NV>>() {
				private Edge<K, NV> output = new Edge<>();

				public Edge<K, NV> map(Edge<K, EV> value) throws Exception {
					output.f0 = value.f0;
					output.f1 = value.f1;
					output.f2 = mapper.map(value);
					return output;
				}
			})
			.returns(returnType)
			.withForwardedFields("f0; f1")
				.name("Map edges");

		return new Graph<>(this.vertices, mappedEdges, this.context);
	}
1196313
def isa_to_graph(isa: ISA) -> nx.Graph:
    
    return nx.from_edgelist(e.targets for e in isa.edges if not e.dead)
530233
def graph(self, ig):
        

        res = copy.copy(self)
        res._edges = ig
        res._nodes = None
        return res
422294
def equiv_graph(self):
        
        eg = nx.Graph()
        for (u,v,d) in self.get_graph().edges(data=True):
            if d['pred'] == 'equivalentTo':
                eg.add_edge(u,v)
        return eg
371060
def frozen_default_graph_def(input_node_names, output_node_names):
  """"""

  sess = tf.get_default_session()
  input_graph_def = tf.get_default_graph().as_graph_def()

  pruned_graph = tf.graph_util.remove_training_nodes(
      input_graph_def, protected_nodes=(output_node_names + input_node_names)
  )
  pruned_graph = tf.graph_util.extract_sub_graph(pruned_graph, output_node_names)

  # remove explicit device assignments
  for node in pruned_graph.node:
      node.device = ""

  all_variable_names = [v.op.name for v in tf.global_variables()]
  output_graph_def = tf.graph_util.convert_variables_to_constants(
      sess=sess,
      input_graph_def=pruned_graph,
      output_node_names=output_node_names,
      variable_names_whitelist=all_variable_names,
  )

  return output_graph_def
316652
def iter_initial_relations(self, subject_graph):
        """"""
        vertex0 = 0
        for vertex1 in range(subject_graph.num_vertices):
            yield vertex0, vertex1
861421
function includesAtSteal(graph) {
	var found = false;

	var isAtSteal = function(name) {
		return name === "@steal";
	};

	keys(graph).forEach(function(name) {
		var node = graph[name];

		if (isPluginExcludedFromBuild(node)) {
			return;
		}

		if (isAtSteal(name)) {
			return (found = true);
		}

		defaultTo(node.dependencies, []).forEach(function(depName) {
			if (isAtSteal(depName)) {
				return (found = true);
			}
		});
	});

	return found;
}
1353880
def graph(bare=False, json=False, json_tree=False, reverse=False):
    """"""
    from ..core import do_graph

    do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse)
467830
public static Graph<Integer, DefaultEdge> buildSymmetryGraph(
			AFPChain selfAlignment) {

		Graph<Integer, DefaultEdge> graph = new SimpleGraph<Integer, DefaultEdge>(
				DefaultEdge.class);

		for (int i = 0; i < selfAlignment.getOptAln().length; i++) {
			for (int j = 0; j < selfAlignment.getOptAln()[i][0].length; j++) {
				Integer res1 = selfAlignment.getOptAln()[i][0][j];
				Integer res2 = selfAlignment.getOptAln()[i][1][j];
				graph.addVertex(res1);
				graph.addVertex(res2);
				graph.addEdge(res1, res2);
			}
		}
		return graph;
	}
476868
function fillDefaultResult(query) {
  if (!query) return {};

  const graph = query.graph || query;

  if (!Array.isArray(graph)) { // invalid graph
    return;
  }

  var defaultResult = {};

  graph.map(([stream, opts]) => {
    if (opts.as) {
      defaultResult[opts.as] = null;
    } else {
      defaultResult[stream] = null;
    }
  });

  return defaultResult;
}
1195888
def build_upstream_edge_predicate(nodes: Iterable[BaseEntity]) -> EdgePredicate:
    """"""
    nodes = set(nodes)

    def upstream_filter(graph: BELGraph, u: BaseEntity, v: BaseEntity, k: str) -> bool:
        """Pass for relations for which one of the given nodes is the object."""
        return v in nodes and graph[u][v][k][RELATION] in CAUSAL_RELATIONS

    return upstream_filter
249388
def with_(self, *relations):
        
        if not relations:
            return self

        eagers = self._parse_with_relations(list(relations))

        self._eager_load.update(eagers)

        return self
1134821
def with_(self, *relations):
        
        if not relations:
            return self

        eagers = self._parse_relations(list(relations))

        self._eager_load.update(eagers)

        return self
950231
def get_graph(graph, conn, **kwargs):
    
    sparql = render_without_request("sparqlGraphDataTemplate.rq",
                                    prefix=NSM.prefix(),
                                    graph=graph)
    return conn.query(sparql, **kwargs)
1280701
public static <V> Set<V> getIncomingVertices(DirectedGraph<V, DefaultEdge> graph, V target) {
        Set<DefaultEdge> edges = graph.incomingEdgesOf(target);
        Set<V> sources = new LinkedHashSet<V>();
        for (DefaultEdge edge : edges) {
            sources.add(graph.getEdgeSource(edge));
        }
        return sources;
    }
112310
function forEachEdge(graph, type, callback) {
  if (graph.size === 0)
    return;

  if (type === 'mixed' || type === graph.type) {
    graph._edges.forEach((data, key) => {

      const {attributes, source, target} = data;

      callback(
        key,
        attributes,
        source.key,
        target.key,
        source.attributes,
        target.attributes
      );
    });
  }
  else {
    const mask = type === 'undirected';

    graph._edges.forEach((data, key) => {
      if ((data instanceof UndirectedEdgeData) === mask) {

        const {attributes, source, target} = data;

        callback(
          key,
          attributes,
          source.key,
          target.key,
          source.attributes,
          target.attributes
        );
      }
    });
  }
}