class_docstr: Base Profiler class to be inherited for custom profiler.
docstr: Build the model dependency graph in order to compute net cost of all
  sub models. graph[model_name] gives the set of all (direct) sub model names.
docstr_tok: ["Build","the","model","dependency","graph","in","order","to","compute","net","cost","of","all","sub","models",".","graph","[","model_name","]","gives","the","set","of","all","(","direct",")","sub","model","names","."]
code: def _build_graph(
      self,
      model: typing.Union[Model, AsyncModel, WrappedAsyncModel],
      graph: Dict[str, Set],
  ) -> Dict[str, Set]:
      """Build the model dependency graph in order to compute net cost of all
      sub models. graph[model_name] gives the set of all (direct) sub model names.
      """
      if isinstance(model, WrappedAsyncModel):
          # let's work on the wrapped model instead of the wrapper
          model = model.async_model
      name = model.configuration_key
      children = set()
      for key in model.model_dependencies:
          children.add(key)
          graph = self._build_graph(
              model.model_dependencies[key], graph
          )
      graph[name] = children  # type: ignore
      return graph
  
file_path: modelkit/modelkit/core/profilers/base.py
imports: import typing
  from abc import ABC, abstractmethod
  from contextlib import contextmanager
  from typing import Dict, Generator, Set
  from modelkit.core.model import AsyncModel, Model, WrappedAsyncModel
label_desc: Use image node_id 7 for calling the BaseProfiler obj's underlying member method code with example usage: obj._build_graph(model, graph) and returns: graph