code: def _compute_nodes_to_reuse(
      node_map: Mapping[str, node_proto_view.NodeProtoView],
      nodes_to_run: Set[str],
      skip_snapshot_node_ids: Set[str],
  ) -> Tuple[Set[str], Set[str]]:
      """Returns the set of node ids whose output artifacts are to be reused.
  
        Only upstream nodes of nodes_to_run are required to be reused to reflect
        correct lineage.
  
      Args:
        node_map: Mapping of node_id to nodes.
        nodes_to_run: The set of nodes to run.
        skip_snapshot_node_ids: The set of nodes that can be skipped for
          snapshotting.
  
      Returns:
        Set of node ids required to be reused.
      """
      exclusion_set = _traverse(
          node_map, _Direction.DOWNSTREAM, start_nodes=nodes_to_run
      )
      nodes_required_to_reuse = (
          _traverse(
              node_map, _Direction.UPSTREAM, start_nodes=nodes_to_run
          )
          - exclusion_set
          - skip_snapshot_node_ids
      )
      nodes_to_reuse = set(node_map.keys()) - exclusion_set
      return nodes_required_to_reuse, nodes_to_reuse
  
imports: import collections
  import concurrent.futures
  import enum
  from typing import Collection, Dict, Final, List, Mapping, Optional, OrderedDict, Sequence, Set, Tuple
  import uuid
  from absl import logging
  from tfx.dsl.compiler import compiler_utils
  from tfx.dsl.compiler import constants
  from tfx.orchestration import metadata
  from tfx.orchestration import node_proto_view
  from tfx.orchestration.portable import execution_publish_utils
  from tfx.orchestration.portable.mlmd import context_lib
  from tfx.orchestration.portable.mlmd import execution_lib
  from tfx.proto.orchestration import pipeline_pb2
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 16 for calling a global function with example usage: _compute_nodes_to_reuse(node_map, nodes_to_run, skip_snapshot_node_ids) and returns: nodes_required_to_reuse,  nodes_to_reuse