code: def const_determined_nodes(gd, assume_variable_nodes=None):
      """
      Given a graph, extract all nodes that only depends on const nodes.
  
      # TODO: extract nodes that depends on the "const part" of placeholders.
      """
      if assume_variable_nodes is None:
          assume_variable_nodes = []
      vis = {}
  
      def visit(node):
          # make sure node is a ParsedNode
          if isinstance(node, six.string_types):
              node = gd[node]
          if node.name in vis:
              return
  
          if "Const" in node.op:
              vis[node.name] = True
          elif "Variable" in node.op:
              vis[node.name] = False
          elif "Placeholder" in node.op:
              vis[node.name] = False
          # TF1 uses TensorArray* while TF2 uses TensorList* ops
          elif "TensorArray" in node.op or "TensorList" in node.op:
              vis[node.name] = False
          elif "function" in node.op:
              vis[node.name] = False
          elif "global" in node.op:
              vis[node.name] = False
          elif node.name in assume_variable_nodes:
              vis[node.name] = False
          else:
              ret = True
              vis[node.name] = False
              for innode in node.inputs:
                  if isinstance(innode, six.string_types):
                      inname = innode
                  else:
                      inname = innode.name
                  if inname not in vis:
                      visit(innode)
                  if not vis[inname]:
                      ret = False
                      break
              vis[node.name] = ret
  
      for k, v in gd.items():
          if k in vis:
              continue
          visit(k)
  
      ret = []
      for k, v in vis.items():
          if v:
              ret.append(k)
      return ret
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import six
label_desc: Use image node_id 19 for calling a global function with example usage: const_determined_nodes(gd, assume_variable_nodes) and returns: ret