docs: def add_node_from_data(self, node: BaseEntity) -> BaseEntity:
          """Add an entity to the graph."""
          assert isinstance(node, BaseEntity)
  
          if node in self:
              return node
  
          self.add_node(node)
  
          if VARIANTS in node:
              self.add_has_variant(node.get_parent(), node)
  
          elif MEMBERS in node:
              for member in node[MEMBERS]:
                  self.add_has_component(node, member)
  
          elif PRODUCTS in node and REACTANTS in node:
              for reactant_tokens in node[REACTANTS]:
                  self.add_has_reactant(node, reactant_tokens)
              for product_tokens in node[PRODUCTS]:
                  self.add_has_product(node, product_tokens)
  
          return node