Deletes this node and all edges referencing it.

        Args:
            node_name (str): The name of the node to delete.

        Raises:
            KeyError: Raised if the node does not exist in the graph.

def delete_node(self, node_name):
        """ Deletes this node and all edges referencing it.

        Args:
            node_name (str): The name of the node to delete.

        Raises:
            KeyError: Raised if the node does not exist in the graph.
        """
        graph = self.graph
        if node_name not in graph:
            raise KeyError('node %s does not exist' % node_name)
        graph.pop(node_name)

        for node, edges in graph.items():
            if node_name in edges:
                edges.remove(node_name)