class_docstr: Helper class to build experiments or trials graph.
class_docstr_tok: ["Helper","class","to","build","experiments","or","trials","graph","."]
docstr: Link parent node to child node.
docstr_tok: ["Link","parent","node","to","child","node","."]
code: def add_link(self, parent, child):
      """Link parent node to child node."""
      if parent not in self.key_to_node:
          self.key_to_node[parent] = TreeNode(parent, self.root)
      if child in self.key_to_node:
          child_node = self.key_to_node[child]
          # A node should have at most 1 parent.
          assert child_node.parent is self.root
          child_node.set_parent(self.key_to_node[parent])
      else:
          self.key_to_node[child] = TreeNode(
              child, self.key_to_node[parent]
          )
  
imports: import logging
  import os
  import shutil
  from typing import Any, Dict, List
  from orion.core.io.database import DatabaseError
  from orion.core.io.database.pickleddb import PickledDB
  from orion.core.utils import generate_temporary_file
  from orion.core.utils.tree import TreeNode
  from orion.storage.base import BaseStorageProtocol, setup_storage
label_desc: Use image node_id 2 for calling the _Graph obj's underlying member method code with example usage: obj.add_link(parent, child) without return types