code: def add_node(self, name, **attr):
          '''
          API: add_node(self, name, **attr)
          Description:
          Adds node to the graph.
          Pre:
              Graph should not contain a node with this name. We do not allow
              multiple nodes with the same name.
          Input:
              name: Name of the node.
              attr: Node attributes.
          Post:
              self.neighbors, self.nodes and self.in_neighbors are updated.
          Return:
              Node (a Node class instance) added to the graph.
          '''
          if name in self.neighbors:
              raise MultipleNodeException
          self.neighbors[name] = list()
          if self.graph_type is DIRECTED_GRAPH:
              self.in_neighbors[name] = list()
          self.nodes[name] = Node(name, **attr)
          return self.nodes[namef add_node(self, name, **attr):
          '''
          API: add_node(self, name, **attr)
          Description:
          Adds node to the graph.
          Pre:
              Graph should not contain a node with this name. We do not allow
              multiple nodes with the same name.
          Input:
              name: Name of the node.
              attr: Node attributes.
          Post:
              self.neighbors, self.nodes and self.in_neighbors are updated.
          Return:
              Node (a Node class instance) added to the graph.
          '''
          if name in self.neighbors:
              raise MultipleNodeException
          self.neighbors[name] = list()
          if self.graph_type is DIRECTED_GRAPH:
              self.in_neighbors[name] = list()
          self.nodes[name] = Node(name, **attr)
          return self.nodes[name]
docs: API: add_node(self, name, **attr)
          Description:
          Adds node to the graph.
          Pre:
              Graph should not contain a node with this name. We do not allow
              multiple nodes with the same name.
          Input:
              name: Name of the node.
              attr: Node attributes.
          Post:
              self.neighbors, self.nodes and self.in_neighbors are updated.
          Return:
              Node (a Node class instance) added to the graph.