Computes `@filename_graph` from `@encountered_graph` and `@definition_graph`.
 This graph is used by `tsort` to sort the filenames for inclusion.
975065
def prepare_filename_graph!
      @filename_graph = {}
      @encountered_graph.each do |filename, encountered_classes|
        dependent_class_names =
          if @definition_graph[filename].nil?
            encountered_classes
          else
            class_names_defined_in_file = @definition_graph[filename].keys
            # all superclass names that this file depends on
            class_names_dependent_by_superclass = @definition_graph[filename].values.compact - class_names_defined_in_file
            class_names_dependent_by_use = encountered_classes - class_names_defined_in_file
            class_names_dependent_by_superclass + class_names_dependent_by_use
          end
        dependent_class_names.each do |dep|
          dependent_definition_fname = @definition_graph.detect { |fname, hash| hash.has_key?(dep) }.first rescue nil
          if dependent_definition_fname
            @filename_graph[filename] ||= []
            unless @filename_graph[filename].include?(dependent_definition_fname)
              @filename_graph[filename] << dependent_definition_fname
            end
          end
        end
      end
    end
349857
def calculate_incorrect_name_dict(graph: BELGraph) -> Mapping[str, List[str]]:
    """"""
    missing = defaultdict(list)

    for namespace, name in _iterate_namespace_name(graph):
        missing[namespace].append(name)

    return dict(missing)
217357
def getGraphFieldCount(self, graph_name):
        
        graph = self._getGraph(graph_name, True)
        return graph.getFieldCount()
447182
def load_metagraph(model_path_prefix: Union[str, Path]) -> tf.train.Saver:
    

    model_path_prefix = str(model_path_prefix)
    metagraph = tf.train.import_meta_graph(model_path_prefix + ".meta")
    return metagraph
1194012
def filtered(self, step_names):
        """"""
        return Graph(steps=self.steps, dag=self.dag.filter(step_names))
733975
function loadPrettyGraphSON(graph, filename, callback) {
        // We need to create an input stream and a reader, both of which are created asyncrously in parallel.
        // It would be nice to use Bluebird.join() perform those two operations, but the declaration for join()
        // in bluebird.d.ts isn't correct. We instead use .all(), and furthermore we use these two local variables
        // to commuicate the results of the two async operations to the final join operation.
        var theStream;
        var theReader;
        function getStream() {
            var readFileP = BluePromise.promisify(fs.readFile);
            return readFileP(filename, 'utf8')
                .then(function (jsonText) {
                var jsonObjArray = JSON.parse(jsonText);
                var jsonTextArray = _.map(jsonObjArray, JSON.stringify);
                return jsonTextArray.join('\n');
            })
                .then(function (uglyText) {
                var StringInputStream = Tinkerpop.autoImport('StringInputStream');
                theStream = StringInputStream.from(uglyText);
                return theStream;
            });
        }
        function getGraphReader() {
            return Tinkerpop.GraphSONReader.buildP()
                .then(function (builder) {
                return _newGraphSONMapper()
                    .then(function (mapper) { return builder.mapperP(mapper); });
            })
                .then(function (builder) { return builder.createP(); })
                .then(function (reader) { theReader = reader; return theReader; });
        }
        return BluePromise.all([getStream(), getGraphReader()])
            .then(function () { return theReader.readGraphP(theStream, graph); })
            .then(function () { return graph; })
            .nodeify(callback);
    }
1090478
def _getMultigraphID(self, graph_name, subgraph_name=None):
        
        if self.isMultiInstance and self._instanceName is not None:
            if subgraph_name is None:
                return "%s_%s" % (graph_name, self._instanceName)
            else:
                return "%s_%s.%s_%s" % (graph_name, self._instanceName, 
                                        subgraph_name, self._instanceName)
        else:
            if subgraph_name is None:
                return graph_name
            else:
                return "%s.%s" % (graph_name, subgraph_name)
831327
def load_graphs():
    ''''''
    mestate.graphs = []
    gfiles = ['mavgraphs.xml']
    if 'HOME' in os.environ:
        for dirname, dirnames, filenames in os.walk(os.path.join(os.environ['HOME'], ".mavproxy")):
            for filename in filenames:
                
                if filename.lower().endswith('.xml'):
                    gfiles.append(os.path.join(dirname, filename))
    for file in gfiles:
        if not os.path.exists(file):
            continue
        graphs = load_graph_xml(open(file).read(), file)
        if graphs:
            mestate.graphs.extend(graphs)
            mestate.console.writeln("Loaded %s" % file)
    # also load the built in graphs
    dlist = pkg_resources.resource_listdir("MAVProxy", "tools/graphs")
    for f in dlist:
        raw = pkg_resources.resource_stream("MAVProxy", "tools/graphs/%s" % f).read()
        graphs = load_graph_xml(raw, None)
        if graphs:
            mestate.graphs.extend(graphs)
            mestate.console.writeln("Loaded %s" % f)
    mestate.graphs = sorted(mestate.graphs, key=lambda g: g.name)
610258
def addEdgeToGraph(parentNodeName, childNodeName, graphFileHandle, colour="black", length="10", weight="1", dir="none", label="", style=""):
    
    graphFileHandle.write('edge[color=%s,len=%s,weight=%s,dir=%s,label="%s",style=%s];\n' % (colour, length, weight, dir, label, style))
    graphFileHandle.write("%s -- %s;\n" % (parentNodeName, childNodeName))
770774
def draw_graph(G: nx.DiGraph, filename: str):
    
    A = to_agraph(G)
    A.graph_attr["rankdir"] = "LR"
    A.draw(filename, prog="dot")
1314803
def load_graph_from_rdf(fname):
    
    print("reading RDF from " + fname + "....")
    store = Graph()
    store.parse(fname, format="n3")
    print("Loaded " + str(len(store)) + " tuples")
    return store
25748
private void fileNameInput(List<FileModel> vertices, GraphRewrite event, ParameterStore store)
    {
        if (this.filenamePattern != null)
        {
            Pattern filenameRegex = filenamePattern.getCompiledPattern(store);
            //in case the filename is the first operation generating result, we can use the graph regex index. That's why we distinguish that in this clause
            if (vertices.isEmpty() && StringUtils.isBlank(getInputVariablesName()))
            {
                FileService fileService = new FileService(event.getGraphContext());
                for (FileModel fileModel : fileService.findByFilenameRegex(filenameRegex.pattern()))
                {
                    vertices.add(fileModel);
                }
            }
            else
            {
                ListIterator<FileModel> fileModelIterator = vertices.listIterator();
                vertices.removeIf(fileModel -> !filenameRegex.matcher(fileModel.getFileName()).matches());
            }
        }
    }
614400
def write_graph(self, filename):
        
        f = open(filename, 'w')
        f.write(self._get_graphviz_data())
        f.close()
982628
def add_file(self, filename):
        """"""

        assert not self.final, 'Trying to mutate a final graph.'
        self.add_source_file(filename)
        resolved, unresolved = self.get_file_deps(filename)
        self.graph.add_node(filename)
        for f in resolved:
            self.graph.add_node(f)
            self.graph.add_edge(filename, f)
        for imp in unresolved:
            self.broken_deps[filename].add(imp)
388086
function loadGraphSONSync(graph, filename) {
        var FileInputStream = Tinkerpop.autoImport('FileInputStream');
        var stream = new FileInputStream(filename);
        var builder = Tinkerpop.GraphSONReader.build();
        var mapper = _newGraphSONMapperSync();
        builder.mapper(mapper);
        var reader = builder.create();
        reader.readGraph(stream, graph);
        return graph;
    }
516128
def new_multigraph(self, name, data=None, **attr):
        
        self._init_graph(name, 'MultiGraph')
        mg = MultiGraph(self, name, data, **attr)
        self._graph_objs[name] = mg
        return mg
1203335
function loadPrettyGraphSONSync(graph, filename) {
        var jsonText = fs.readFileSync(filename, { encoding: 'utf8' });
        var jsonObjArray = JSON.parse(jsonText);
        var jsonTextArray = _.map(jsonObjArray, JSON.stringify);
        var uglyText = jsonTextArray.join('\n');
        var StringInputStream = Tinkerpop.autoImport('StringInputStream');
        var stream = StringInputStream.from(uglyText);
        var builder = Tinkerpop.GraphSONReader.build();
        var mapper = _newGraphSONMapperSync();
        builder.mapper(mapper);
        var reader = builder.create();
        reader.readGraph(stream, graph);
        return graph;
    }