code: def GnnNetsNC2valueFunc(gnnNets_NC, node_idx, target_class):
      def value_func(data):
          with torch.no_grad():
              logits = gnnNets_NC(data=data)
              probs = F.softmax(logits, dim=-1)
              # select the corresponding node prob through the node idx on all the sampling graphs
              batch_size = data.batch.max() + 1
              probs = probs.reshape(batch_size, -1, probs.shape[-1])
              score = probs[:, node_idx, target_class]
              return score
  
      return value_func
  
imports: import copy
  import torch
  import numpy
  from scipy.special import comb
  from itertools import combinations
  import torch.nn.functional
  from torch_geometric.utils import to_networkx
  from torch_geometric.data import Data, Batch, Dataset
  from torch_geometric.loader import DataLoader
label_desc: Use image node_id 2 for calling a global function with example usage: GnnNetsNC2valueFunc(gnnNets_NC, node_idx, target_class) and returns: value_func, score