class_docstr: The GNNExplainer model from the paper:
  
  > [GNNExplainer: Generating Explanations for Graph Neural Networks](https://arxiv.org/abs/1903.03894)<br>
  > Rex Ying, Dylan Bourgeois, Jiaxuan You, Marinka Zitnik and Jure Leskovec.
  
  The model can be used to explain the predictions for a single node or for an entire
  graph. In both cases, it returns the subgraph that mostly contributes to the
  prediction.
  
  **Arguments**
  
  - `model`: tf.keras.Model to explain;
  - `n_hops`: number of hops from which the GNN aggregates info. If `None`, then the
  number is inferred from the Conv and MessagePassing layers in the model.
  - `preprocess`: a preprocessing function to transform the adjacency matrix before
  giving it as input to the GNN; this is usually the same `preprocess` function of the
  Conv or MessagePassing layers used in the GNN (e.g., `GCNConv.preprocess`).
  - `graph_level`: if True, the GNN is assumed to be for graph-level prediction and
  the explanation is computed for the whole graph (and not just a node).
  - `verbose`: if True, print info during training;
  - `learning_rate`: learning rate when training the model;
  - `a_size_coef`: coefficient to control the number of edges of the subgraph that
  contributes to the prediction;
  - `x_size_coef`: coefficient to control the number of features of the subgraph
  that contributes to the prediction;
  - `a_entropy_coef`: coefficient to control the discretization of the adjacency
  mask;
  - `x_entropy_coef`: coefficient to control the discretization of the features
  mask;
  - `laplacian_coef`: coefficient to control the graph Laplacian loss;
class_docstr_tok: ["The","GNNExplainer","model","from","the","paper",":",">","[","GNNExplainer",":","Generating","Explanations","for","Graph","Neural","Networks","]","(","https",":","\/\/arxiv.org\/abs\/1903.03894",")","<","br",">",">","Rex","Ying",",","Dylan","Bourgeois",",","Jiaxuan","You",",","Marinka","Zitnik","and","Jure","Leskovec",".","The","model","can","be","used","to","explain","the","predictions","for","a","single","node","or","for","an","entire","graph",".","In","both","cases",",","it","returns","the","subgraph","that","mostly","contributes","to","the","prediction",".","*","*","Arguments","*","*","-","`","model","`",":","tf.keras.Model","to","explain",";","-","`","n_hops","`",":","number","of","hops","from","which","the","GNN","aggregates","info",".","If","`","None","`",",","then","the","number","is","inferred","from","the","Conv","and","MessagePassing","layers","in","the","model",".","-","`","preprocess","`",":","a","preprocessing","function","to","transform","the","adjacency","matrix","before","giving","it","as","input","to","the","GNN",";","this","is","usually","the","same","`","preprocess","`","function","of","the","Conv","or","MessagePassing","layers","used","in","the","GNN","(","e.g.",",","`","GCNConv.preprocess","`",")",".","-","`","graph_level","`",":","if","True",",","the","GNN","is","assumed","to","be","for","graph-level","prediction","and","the","explanation","is","computed","for","the","whole","graph","(","and","not","just","a","node",")",".","-","`","verbose","`",":","if","True",",","print","info","during","training",";","-","`","learning_rate","`",":","learning","rate","when","training","the","model",";","-","`","a_size_coef","`",":","coefficient","to","control","the","number","of","edges","of","the","subgraph","that","contributes","to","the","prediction",";","-","`","x_size_coef","`",":","coefficient","to","control","the","number","of","features","of","the","subgraph","that","contributes","to","the","prediction",";","-","`","a_entropy_coef","`",":","coefficient","to","control","the","discretization","of","the","adjacency","mask",";","-","`","x_entropy_coef","`",":","coefficient","to","control","the","discretization","of","the","features","mask",";","-","`","laplacian_coef","`",":","coefficient","to","control","the","graph","Laplacian","loss",";"]
docstr: Plot the subgraph computed by the GNNExplainer.
  
  **Arguments**
  :param a_mask: the mask for the adjacency matrix computed by `explain_node`;
  :param x_mask: the mask for the node features computed by `explain_node`;
  :param node_idx: the same node index that was given to `explain_node`;
  :param a_thresh: threshold to remove low-importance edges;
  :param return_features: if True, return indices to sort the nodes by their
  importance.
  :return: The subgraph computed by GNNExplainer in Networkx format. If
  `return_features=True`, also returns an indices to sort the nodes by their
  importance.
docstr_tok: ["Plot","the","subgraph","computed","by","the","GNNExplainer",".","*","*","Arguments","*","*",":","param","a_mask",":","the","mask","for","the","adjacency","matrix","computed","by","`","explain_node","`",";",":","param","x_mask",":","the","mask","for","the","node","features","computed","by","`","explain_node","`",";",":","param","node_idx",":","the","same","node","index","that","was","given","to","`","explain_node","`",";",":","param","a_thresh",":","threshold","to","remove","low-importance","edges",";",":","param","return_features",":","if","True",",","return","indices","to","sort","the","nodes","by","their","importance",".",":","return",":","The","subgraph","computed","by","GNNExplainer","in","Networkx","format",".","If","`","return_features=True","`",",","also","returns","an","indices","to","sort","the","nodes","by","their","importance","."]
code: def plot_subgraph(
      self,
      a_mask,
      x_mask,
      node_idx=None,
      a_thresh=0.1,
      return_features=False,
  ):
      """
      Plot the subgraph computed by the GNNExplainer.
  
      **Arguments**
      :param a_mask: the mask for the adjacency matrix computed by `explain_node`;
      :param x_mask: the mask for the node features computed by `explain_node`;
      :param node_idx: the same node index that was given to `explain_node`;
      :param a_thresh: threshold to remove low-importance edges;
      :param return_features: if True, return indices to sort the nodes by their
      importance.
      :return: The subgraph computed by GNNExplainer in Networkx format. If
      `return_features=True`, also returns an indices to sort the nodes by their
      importance.
      """
      adj_mtx, top_ftrs = self._explainer_cleaning(
          a_mask, x_mask, node_idx, a_thresh
      )
  
      edge_list = adj_mtx.indices.numpy()
      weights = adj_mtx.values
  
      G = nx.Graph()
      for i, (n1, n2) in enumerate(edge_list):
          if weights[i] != 0:
              G.add_edge(n1, n2, w=weights[i].numpy())
  
      # take the largest component
      giant = max(
          nx.algorithms.components.connected_components(G), key=len
      )
  
      pos = nx.layout.spring_layout(G, k=0.04)
      nx.draw_networkx_nodes(G, pos=pos, node_size=30, nodelist=giant)
      nx.draw_networkx_edges(G, pos=pos, edge_color="grey", alpha=0.8)
      nx.draw_networkx_labels(
          G,
          pos=pos,
          font_color="black",
          font_size=10,
          verticalalignment="bottom",
      )
  
      if return_features:
          return G, top_ftrs
      else:
          return G
  
file_path: spektral/spektral/models/gnn_explainer.py
imports: import networkx
  import numpy
  import tensorflow
  from scipy.sparse import csr_matrix
  from spektral.layers import MessagePassing
  from spektral.layers.convolutional.conv import Conv
  from spektral.layers.ops import dot
  from spektral.utils.sparse import sp_matrix_to_sp_tensor
label_desc: Use image node_id 6 for calling the GNNExplainer obj's underlying member method code with example usage: obj.plot_subgraph(a_mask, x_mask, node_idx, a_thresh, return_features) and returns: G,  top_ftrs, G