class_docstr: GenerationStrategy describes which model should be used to generate new
  points for which trials, enabling and automating use of different models
  throughout the optimization process. For instance, it allows to use one
  model for the initialization trials, and another one for all subsequent
  trials. In the general case, this allows to automate use of an arbitrary
  number of models to generate an arbitrary numbers of trials
  described in the `trials_per_model` argument.
  
  Args:
      nodes: A list of `GenerationNode`. Each `GenerationNode` in the list
          represents a single node in a `GenerationStrategy` which, when
          composed of `GenerationNodes`, can be conceptualized as a graph instead
          of a linear list. `TransitionCriterion` defined in each `GenerationNode`
          represent the edges in the `GenerationStrategy` graph. `GenerationNodes`
          are more flexible than `GenerationSteps` and new `GenerationStrategies`
          should use nodes. Notably, either, but not both, of `nodes` and `steps`
          must be provided.
      steps: A list of `GenerationStep` describing steps of this strategy.
      name: An optional name for this generaiton strategy. If not specified,
          strategy's name will be names of its nodes' models joined with '+'.
docstr: Initialize and validate the node graph provided to this GenerationStrategy.
  
  This function validates:
      1. That all nodes have unique names.
      2. That there is at least one node with a transition_to field.
      3. That all `transition_to` attributes on a TransitionCriterion point to
          another node in the same GenerationStrategy.
      4. Warns if no nodes contain a transition criterion
docstr_tok: ["Initialize","and","validate","the","node","graph","provided","to","this","GenerationStrategy",".","This","function","validates",":","1",".","That","all","nodes","have","unique","names",".","2",".","That","there","is","at","least","one","node","with","a","transition_to","field",".","3",".","That","all","`","transition_to","`","attributes","on","a","TransitionCriterion","point","to","another","node","in","the","same","GenerationStrategy",".","4",".","Warns","if","no","nodes","contain","a","transition","criterion"]
code: def _validate_and_set_node_graph(
      self, nodes: List[GenerationNode]
  ) -> None:
      """Initialize and validate the node graph provided to this GenerationStrategy.
  
      This function validates:
          1. That all nodes have unique names.
          2. That there is at least one node with a transition_to field.
          3. That all `transition_to` attributes on a TransitionCriterion point to
              another node in the same GenerationStrategy.
          4. Warns if no nodes contain a transition criterion
      """
      node_names = []
      for node in self._nodes:
          # validate that all node names are unique
          if node.node_name in node_names:
              raise GenerationStrategyMisconfiguredException(
                  error_info="All node names in a GenerationStrategy "
                  + "must be unique."
              )
  
          node_names.append(node.node_name)
          node._generation_strategy = self
  
      # validate `transition_criterion`
      contains_a_transition_to_argument = False
      for node in self._nodes:
          for transition_criteria in node.transition_criteria:
              if transition_criteria.transition_to is not None:
                  contains_a_transition_to_argument = True
                  if (
                      transition_criteria.transition_to
                      not in node_names
                  ):
                      raise GenerationStrategyMisconfiguredException(
                          error_info=f"`transition_to` argument "
                          f"{transition_criteria.transition_to} does not "
                          "correspond to any node in this GenerationStrategy."
                      )
  
      # validate that at least one node has transition_to field
      if len(self._nodes) > 1 and not contains_a_transition_to_argument:
          logger.warning(
              "None of the nodes in this GenerationStrategy "
              "contain a `transition_to` argument in their transition_criteria. "
              "Therefore, the GenerationStrategy will not be able to "
              "move from one node to another. Please add a "
              "`transition_to` argument."
          )
      self._curr = nodes[0]
  
imports: from __future__ import annotations
  from copy import deepcopy
  from functools import wraps
  from logging import Logger
  from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar
  import pandas
  from ax.core.data import Data
  from ax.core.experiment import Experiment
  from ax.core.generation_strategy_interface import GenerationStrategyInterface
  from ax.core.generator_run import GeneratorRun
  from ax.core.observation import ObservationFeatures
  from ax.core.utils import extend_pending_observations, get_pending_observation_features_based_on_trial_status
  from ax.exceptions.core import DataRequiredError, UnsupportedError, UserInputError
  from ax.exceptions.generation_strategy import GenerationStrategyCompleted, GenerationStrategyMisconfiguredException
  from ax.modelbridge.base import ModelBridge
  from ax.modelbridge.generation_node import GenerationNode, GenerationStep
  from ax.modelbridge.model_spec import FactoryFunctionModelSpec
  from ax.modelbridge.registry import _extract_model_state_after_gen, ModelRegistryBase
  from ax.modelbridge.transition_criterion import TrialBasedCriterion
  from ax.utils.common.logger import _round_floats_for_logging, get_logger
  from ax.utils.common.typeutils import checked_cast, not_none
label_desc: Use image node_id 17 for calling the GenerationStrategy obj's underlying member method code with example usage: obj._validate_and_set_node_graph(nodes) without return types