code: def _find_candidates_Di(u, graph_params, state_params, G1_degree):
      (
          G1,
          G2,
          G1_labels,
          _,
          _,
          nodes_of_G2Labels,
          G2_nodes_of_degree,
      ) = graph_params
      (
          mapping,
          reverse_mapping,
          _,
          _,
          _,
          _,
          _,
          _,
          T2_tilde,
          _,
      ) = state_params
  
      covered_successors = [succ for succ in G1[u] if succ in mapping]
      covered_predecessors = [
          pred for pred in G1.pred[u] if pred in mapping
      ]
  
      if not (covered_successors or covered_predecessors):
          candidates = set(nodes_of_G2Labels[G1_labels[u]])
          candidates.intersection_update(
              G2_nodes_of_degree[G1_degree[u]]
          )
          candidates.intersection_update(T2_tilde)
          candidates.difference_update(reverse_mapping)
          if G1.is_multigraph():
              candidates.difference_update(
                  {
                      node
                      for node in candidates
                      if G1.number_of_edges(u, u)
                      != G2.number_of_edges(node, node)
                  }
              )
          return candidates
  
      if covered_successors:
          succ1 = covered_successors[0]
          common_nodes = set(G2.pred[mapping[succ1]])
  
          for succ1 in covered_successors[1:]:
              common_nodes.intersection_update(G2.pred[mapping[succ1]])
      else:
          pred1 = covered_predecessors.pop()
          common_nodes = set(G2[mapping[pred1]])
  
      for pred1 in covered_predecessors:
          common_nodes.intersection_update(G2[mapping[pred1]])
  
      common_nodes.difference_update(reverse_mapping)
      common_nodes.intersection_update(G2_nodes_of_degree[G1_degree[u]])
      common_nodes.intersection_update(nodes_of_G2Labels[G1_labels[u]])
      if G1.is_multigraph():
          common_nodes.difference_update(
              {
                  node
                  for node in common_nodes
                  if G1.number_of_edges(u, u)
                  != G2.number_of_edges(node, node)
              }
          )
      return common_nodes
  
file_path: networkx/networkx/algorithms/isomorphism/vf2pp.py
imports: import collections
  import networkx
label_desc: Use image node_id 8 for calling a global function with example usage: _find_candidates_Di(u, graph_params, state_params, G1_degree) and returns: common_nodes, candidates