docs: def compute_pool(instance1, attribute1, relation1,
                   instance2, attribute2, relation2,
                   prefix1, prefix2, doinstance=True, doattribute=True, dorelation=True):
      """
      compute all possible node mapping candidates and their weights (the triple matching number gain resulting from
      mapping one node in AMR 1 to another node in AMR2)
  
      Arguments:
          instance1: instance triples of AMR 1
          attribute1: attribute triples of AMR 1 (attribute name, node name, attribute value)
          relation1: relation triples of AMR 1 (relation name, node 1 name, node 2 name)
          instance2: instance triples of AMR 2
          attribute2: attribute triples of AMR 2 (attribute name, node name, attribute value)
          relation2: relation triples of AMR 2 (relation name, node 1 name, node 2 name
          prefix1: prefix label for AMR 1
          prefix2: prefix label for AMR 2
      Returns:
        candidate_mapping: a list of candidate nodes.
                         The ith element contains the node indices (in AMR 2) the ith node (in AMR 1) can map to.
                         (resulting in non-zero triple match)
        weight_dict: a dictionary which contains the matching triple number for every pair of node mapping. The key
                     is a node pair. The value is another dictionary. key {-1} is triple match resulting from this node
                     pair alone (instance triples and attribute triples), and other keys are node pairs that can result
                     in relation triple match together with the first node pair.
  
  
      """
      candidate_mapping = []
      weight_dict = {}
      for instance1_item in instance1:
          # each candidate mapping is a set of node indices
          candidate_mapping.append(set())
          if doinstance:
              for instance2_item in instance2:
                  # if both triples are instance triples and have the same value
                  if normalize(instance1_item[0]) == normalize(instance2_item[0]) and \
                          normalize(instance1_item[2]) == normalize(instance2_item[2]):
                      # get node index by stripping the prefix
                      node1_index = int(instance1_item[1][len(prefix1):])
                      node2_index = int(instance2_item[1][len(prefix2):])
                      candidate_mapping[node1_index].add(node2_index)
                      node_pair = (node1_index, node2_index)
                      # use -1 as key in weight_dict for instance triples and attribute triples
                      if node_pair in weight_dict:
                          weight_dict[node_pair][-1] += 1
                      else:
                          weight_dict[node_pair] = {}
                          weight_dict[node_pair][-1] = 1
      if doattribute:
          for attribute1_item in attribute1:
              for attribute2_item in attribute2:
                  # if both attribute relation triple have the same relation name and value
                  if normalize(attribute1_item[0]) == normalize(attribute2_item[0]) \
                          and normalize(attribute1_item[2]) == normalize(attribute2_item[2]):
                      node1_index = int(attribute1_item[1][len(prefix1):])
                      node2_index = int(attribute2_item[1][len(prefix2):])
                      candidate_mapping[node1_index].add(node2_index)
                      node_pair = (node1_index, node2_index)
                      # use -1 as key in weight_dict for instance triples and attribute triples
                      if node_pair in weight_dict:
                          weight_dict[node_pair][-1] += 1
                      else:
                          weight_dict[node_pair] = {}
                          weight_dict[node_pair][-1] = 1
      if dorelation:
          for relation1_item in relation1:
              for relation2_item in relation2:
                  # if both relation share the same name
                  if normalize(relation1_item[0]) == normalize(relation2_item[0]):
                      node1_index_amr1 = int(relation1_item[1][len(prefix1):])
                      node1_index_amr2 = int(relation2_item[1][len(prefix2):])
                      node2_index_amr1 = int(relation1_item[2][len(prefix1):])
                      node2_index_amr2 = int(relation2_item[2][len(prefix2):])
                      # add mapping between two nodes
                      candidate_mapping[node1_index_amr1].add(node1_index_amr2)
                      candidate_mapping[node2_index_amr1].add(node2_index_amr2)
                      node_pair1 = (node1_index_amr1, node1_index_amr2)
                      node_pair2 = (node2_index_amr1, node2_index_amr2)
                      if node_pair2 != node_pair1:
                          # update weight_dict weight. Note that we need to update both entries for future search
                          # i.e weight_dict[node_pair1][node_pair2]
                          #     weight_dict[node_pair2][node_pair1]
                          if node1_index_amr1 > node2_index_amr1:
                              # swap node_pair1 and node_pair2
                              node_pair1 = (node2_index_amr1, node2_index_amr2)
                              node_pair2 = (node1_index_amr1, node1_index_amr2)
                          if node_pair1 in weight_dict:
                              if node_pair2 in weight_dict[node_pair1]:
                                  weight_dict[node_pair1][node_pair2] += 1
                              else:
                                  weight_dict[node_pair1][node_pair2] = 1
                          else:
                              weight_dict[node_pair1] = {-1: 0, node_pair2: 1}
                          if node_pair2 in weight_dict:
                              if node_pair1 in weight_dict[node_pair2]:
                                  weight_dict[node_pair2][node_pair1] += 1
                              else:
                                  weight_dict[node_pair2][node_pair1] = 1
                          else:
                              weight_dict[node_pair2] = {-1: 0, node_pair1: 1}
                      else:
                          # two node pairs are the same. So we only update weight_dict once.
                          # this generally should not happen.
                          if node_pair1 in weight_dict:
                              weight_dict[node_pair1][-1] += 1
                          else:
                              weight_dict[node_pair1] = {-1: 1}
      return candidate_mapping, weight_dict