def calc_node_idx(point_idx: int, configuration: int) -> int:
    """
    Calculates a unique node index.
    :param point_idx: Index of the point that the node belongs to within the trajectory.
    :param configuration: Robot configuration for the node
    :return: Integer value for the node index
    """
    if 0 <= configuration <= 7:
        if point_idx >= 0:
            return 8 * point_idx + configuration
        raise ValueError('Point index must be positive.')
    raise ValueError('Only configurations from 0-7 are allowed.')