Should a progressbar go both ways?

I'm developing a long-running algorithm and want to give my users an idea of what is the current state of the calculation. I thought of adding a progress bar indicating the percentage of all the calculations already done.

My problem is that the total number of calculations to perform can not be estimated beforehand. I'm somehow discovering a tree and cannot know how vast the tree is without actually exploring it.

With regards to the progress bar it means that the progress bar can sometimes go backward.

For example, let's say that my tree has 10 root elements at the beginning, I perform calculations on the first element so I'm at 1/10 = 10% completion but discover 10 new others elements at the same time, leading to a 1/20 = 5% completion.

Is the progress bar still useful is that case ? I want to avoid to only report X out of Y elements processed.

Is there a better way to report the status of the number of processed elements when the number of elements to process can grow ?