def nodeKey(search, node, goal, heuristicFunc):
    """
    Give sort key that prioritizes node based on search, where min key is higher priority. 
    
    This prioritization is essentially the difference between the various search algorithms.
    """
    
    if search == 'A*':
        g = node.cost;
        h = heuristicFunc(node.path[-1], goal);
        key = g + h;    
    elif search == 'BFS':
        key = len(node.acts);
    elif search == 'DFS' or search == 'IDDFS':
        key = -len(node.acts);
    elif search == 'UCS':
        key = node.cost;
    else:
        raise ValueError('Invalid search type: ' + search);
        
    return key;