class_docstr: Represents a graph for training a model or making predictions.
class_docstr_tok: ["Represents","a","graph","for","training","a","model","or","making","predictions","."]
docstr: Returns a new schema where all nodes are a descendant of a target.
code: def minimal_graph_schema(
      self, targets: Optional[List[Text]] = None
  ) -> GraphSchema:
      """Returns a new schema where all nodes are a descendant of a target."""
      dependencies = self._all_dependencies_schema(
          targets if targets else self.target_names
      )
  
      return GraphSchema(
          {
              node_name: node
              for node_name, node in self.nodes.items()
              if node_name in dependencies
          }
      )
  
imports: from __future__ import annotations
  import dataclasses
  from abc import ABC, abstractmethod
  from dataclasses import dataclass, field
  import logging
  from typing import Any, Callable, Dict, List, Optional, Text, Type, Tuple, Union
  from rasa.engine.exceptions import GraphComponentException, GraphRunError, GraphSchemaException
  import rasa.shared.utils.common
  import rasa.utils.common
  from rasa.engine.storage.resource import Resource
  from rasa.engine.storage.storage import ModelStorage
  from rasa.shared.exceptions import InvalidConfigException, RasaException
  from rasa.shared.data import TrainingType
label_desc: Use image node_id 4 for calling the GraphSchema obj's underlying member method code with example usage: obj.minimal_graph_schema(targets) and returns: GraphSchema