original_docstring: 
          Applies this transformation to a given subgraph, defined by a set of
          nodes. Raises an error if arguments are invalid or transformation is
          not applicable.
  
          To apply the transformation on a specific subgraph, the `where`
          parameter can be used either on a subgraph object (`SubgraphView`), or
          on directly on a list of subgraph nodes, given as `Node` or `SDFGState`
          objects. Transformation properties can then be given as keyword
          arguments. For example, applying `SubgraphFusion` on a subgraph of three
          nodes can be called in one of two ways:
          ```
          # Subgraph
          SubgraphFusion.apply_to(
              sdfg, SubgraphView(state, [node_a, node_b, node_c]))
  
          # Simplified API: list of nodes
          SubgraphFusion.apply_to(sdfg, node_a, node_b, node_c)
          ```
  
          :param sdfg: The SDFG to apply the transformation to.
          :param where: A set of nodes in the SDFG/state, or a subgraph thereof.
          :param verify: Check that `can_be_applied` returns True before applying.
          :param options: A set of parameters to use for applying the
                          transformation.
          
docstring: Applies this transformation to a given subgraph, defined by a set of
  nodes. Raises an error if arguments are invalid or transformation is
  not applicable.
  
  
  
  
docstring_tokens: Applies this transformation to a given subgraph defined by a set of nodes . Raises an error if arguments are invalid or transformation is not applicable .
code: def apply_to(cls,
                   sdfg: SDFG,
                   *where: Union[nd.Node, SDFGState, gr.SubgraphView],
                   verify: bool = True,
                   **options: Any):
          """
          Applies this transformation to a given subgraph, defined by a set of
          nodes. Raises an error if arguments are invalid or transformation is
          not applicable.
  
          To apply the transformation on a specific subgraph, the `where`
          parameter can be used either on a subgraph object (`SubgraphView`), or
          on directly on a list of subgraph nodes, given as `Node` or `SDFGState`
          objects. Transformation properties can then be given as keyword
          arguments. For example, applying `SubgraphFusion` on a subgraph of three
          nodes can be called in one of two ways:
          ```
          # Subgraph
          SubgraphFusion.apply_to(
              sdfg, SubgraphView(state, [node_a, node_b, node_c]))
  
          # Simplified API: list of nodes
          SubgraphFusion.apply_to(sdfg, node_a, node_b, node_c)
          ```
  
          :param sdfg: The SDFG to apply the transformation to.
          :param where: A set of nodes in the SDFG/state, or a subgraph thereof.
          :param verify: Check that `can_be_applied` returns True before applying.
          :param options: A set of parameters to use for applying the
                          transformation.
          """
          subgraph = None
          if len(where) == 1:
              if isinstance(where[0], (list, tuple)):
                  where = where[0]
              elif isinstance(where[0], gr.SubgraphView):
                  subgraph = where[0]
          if len(where) == 0:
              raise ValueError('At least one node is required')
  
          # Check that all keyword arguments are nodes and if interstate or not
          if subgraph is None:
              sample_node = where[0]
  
              if isinstance(sample_node, SDFGState):
                  graph = sdfg
                  state_id = -1
              elif isinstance(sample_node, nd.Node):
                  graph = next(s for s in sdfg.nodes() if sample_node in s.nodes())
                  state_id = sdfg.node_id(graph)
              else:
                  raise TypeError('Invalid node type "%s"' % type(sample_node).__name__)
  
              # Construct subgraph and instantiate transformation
              subgraph = gr.SubgraphView(graph, where)
              instance = cls(subgraph, sdfg.sdfg_id, state_id)
          else:
              # Construct instance from subgraph directly
              instance = cls(subgraph)
  
          # Construct transformation parameters
          for optname, optval in options.items():
              if not optname in cls.__properties__:
                  raise ValueError('Property "%s" not found in transformation' % optname)
              setattr(instance, optname, optval)
  
          if verify:
              if not instance.can_be_applied(sdfg, subgraph):
                  raise ValueError('Transformation cannot be applied on the ' 'given subgraph ("can_be_applied" failed)')
  
          # Apply to SDFG
          return instance.apply(sdfg)
code_tokens: def apply_to ( cls , sdfg : SDFG , * where : Union [ nd . Node , SDFGState , gr . SubgraphView ] , verify : bool = True , ** options : Any ) : subgraph = None if len ( where ) == 1 : if isinstance ( where [ 0 ] , ( list , tuple ) ) : where = where [ 0 ] elif isinstance ( where [ 0 ] , gr . SubgraphView ) : subgraph = where [ 0 ] if len ( where ) == 0 : raise ValueError ( 'At least one node is required' ) if subgraph is None : sample_node = where [ 0 ] if isinstance ( sample_node , SDFGState ) : graph = sdfg state_id = - 1 elif isinstance ( sample_node , nd . Node ) : graph = next ( s for s in sdfg . nodes ( ) if sample_node in s . nodes ( ) ) state_id = sdfg . node_id ( graph ) else : raise TypeError ( 'Invalid node type "%s"' % type ( sample_node ) . __name__ ) subgraph = gr . SubgraphView ( graph , where ) instance = cls ( subgraph , sdfg . sdfg_id , state_id ) else : instance = cls ( subgraph ) for optname , optval in options . items ( ) : if not optname in cls . __properties__ : raise ValueError ( 'Property "%s" not found in transformation' % optname ) setattr ( instance , optname , optval ) if verify : if not instance . can_be_applied ( sdfg , subgraph ) : raise ValueError ( 'Transformation cannot be applied on the ' 'given subgraph ("can_be_applied" failed)' ) return instance . apply ( sdfg )
short_docstring: Applies this transformation to a given subgraph, defined by a set of
  nodes.
short_docstring_tokens: Applies this transformation to a given subgraph defined by a set of nodes .
comment: """
          Applies this transformation to a given subgraph, defined by a set of
          nodes. Raises an error if arguments are invalid or transformation is
          not applicable.
  
          To apply the transformation on a specific subgraph, the `where`
          parameter can be used either on a subgraph object (`SubgraphView`), or
          on directly on a list of subgraph nodes, given as `Node` or `SDFGState`
          objects. Transformation properties can then be given as keyword
          arguments. For example, applying `SubgraphFusion` on a subgraph of three
          nodes can be called in one of two ways:
          ```
          # Subgraph
          SubgraphFusion.apply_to(
              sdfg, SubgraphView(state, [node_a, node_b, node_c]))
  
          # Simplified API: list of nodes
          SubgraphFusion.apply_to(sdfg, node_a, node_b, node_c)
          ```
  
          :param sdfg: The SDFG to apply the transformation to.
          :param where: A set of nodes in the SDFG/state, or a subgraph thereof.
          :param verify: Check that `can_be_applied` returns True before applying.
          :param options: A set of parameters to use for applying the
                          transformation.
          """$SEP$# Check that all keyword arguments are nodes and if interstate or not$SEP$# Construct subgraph and instantiate transformation$SEP$# Construct instance from subgraph directly$SEP$# Construct transformation parameters$SEP$# Apply to SDFG