'Add a new node to the hierarchy
@param node_id: the node ID
@param parent_id: the parent node ID
@param category: the category'

def add(self, node_id, parent_id=None, category=None):

    theset = self.__theset
    if (node_id in theset):
        node = theset[node_id]
        if (category is not None):
            node['c'] = category
    elif node_id:
        node = {'s': set(), 'c': category}
    else:
        raise SyntaxError
    if parent_id:
        if (parent_id not in theset):
            parent = self.add(parent_id, None, None)
        else:
            parent = theset[parent_id]
        parent['s'].add(node_id)
    node['p'] = parent_id
    theset[node_id] = node
    return node
