Hello,
There is a small design issue I am stuck up with. It's kind of crazy
but will reduce my computations multifold times.
I am implementing improved version of Yen's K-Shortest path algorithm
(
https://estudogeral.sib.uc.pt/bitstream/10316/7763/1/obra.pdf)
Now there is a small issue here. Inside the algorithm, in say
computing top 4 shortest path, what the algorithm does is that it say
when computing the 2nd shortest path; It removes arcs of the 1st
shortest path from the graph. And so removes the 2nd while computing
3rd shortest path and so on. And later in the end, it adds all the
removed arcs.
Now the issue here is that when one thread is computing a kth shortest
path, other threads cannot use the algorithm as the graph is not in
its complete shape.
Here is the crazy part which I am unsure of if at all its a good
practice:
I will have the code inside a transaction, but not let the transaction
succeed. i.e. I will implement the algorithm and remove the respective
arcs in the process, when I have the desired output, I will call the
transaction a failure. hence the arcs are never removed and the same
instance of the algorithm can be used. Further there will be no need
to later add those arcs as in reality they were never removed.
But is it a good design to use transactions in such a way?
Regards