code: def adjacency_correlations(
      data: pd.DataFrame,
      bn: BayesianNetwork,
      method: str,
  ) -> pd.DataFrame:
      """
      Utility function to compute pairwise correlation of connected nodes in a graph
  
      Args:
          data: Input dataframe
          bn: Bayesian network
          method: Correlation scoring method - {‘pearson’, ‘kendall’, ‘spearman’} or callable
  
      Returns:
          Correlation dataframe
      """
      correl_df = data[bn.nodes].corr(method=method)
      edge_set = set(bn.structure.edges())
  
      for row in correl_df.index:
          for col in correl_df.columns:
              if (row, col) not in edge_set:
                  correl_df.loc[row, col] = np.nan
  
      return correl_df
  
imports: import json
  import multiprocessing
  import os
  import warnings
  from collections import defaultdict
  from time import time
  from typing import List, Tuple
  import dataframe_image
  import networkx
  import numpy
  import pandas
  from IPython.core.display import display
  from IPython.display import Image
  from sklearn import metrics
  from sklearn.model_selection import KFold
  from causalnex.evaluation import roc_auc
  from causalnex.inference import InferenceEngine
  from causalnex.network import BayesianNetwork
  from causalnex.plots import plot_structure
  from causalnex.structure import StructureModel
label_desc: Use image node_id 4 for calling a global function with example usage: adjacency_correlations(data, bn, method) and returns: correl_df