code: def apply_transform(self, transform):
          
          dimension = self.vertices.shape[1]
          transform = np.asanyarray(transform, dtype=np.float64)
  
          if transform.shape != (dimension + 1, dimension + 1):
              raise ValueError('transform is incorrect shape!')
          elif np.abs(transform - np.eye(dimension + 1)).max() < 1e-8:
              # if we've been passed an identity matrix do nothing
              return
  
          # make sure cache is up to date
          self._cache.verify()
          # new cache to transfer items
          cache = {}
          # apply transform to discretized paths
          if 'discrete' in self._cache.cache:
              cache['discrete'] = np.array([
                  transformations.transform_points(
                      d, matrix=transform)
                  for d in self.discrete])
  
          # things we can just straight up copy
          # as they are topological not geometric
          for key in ['root',
                      'paths',
                      'path_valid',
                      'dangling',
                      'vertex_graph',
                      'enclosure',
                      'enclosure_shell',
                      'enclosure_directed']:
              # if they're in cache save them from the purge
              if key in self._cache.cache:
                  cache[key] = self._cache.cache[key]
  
          # transform vertices in place
          self.vertices = transformations.transform_points(
              self.vertices,
              matrix=transform)
          # explicitly clear the cache
          self._cache.clear()
          self._cache.id_set()
  
          # populate the things we wangled
          self._cache.cache.update(cache)
docs: Apply a transformation matrix to the current path in- place
  
          Parameters
          -----------
          transform : (d+1, d+1) float
            Homogenous transformation for vertices