Traversal in a graph with a loop never ends

Issue #4 new
giuseppe cardellini
created an issue

The approach used now does not deal with loop (you can try with the simple db attached). While the GT traverse each node only once this does not happens for the traversal in temporalis that only cutoff based on impact. When loop occurs, being convolution applied each loop, the exchange amount increases bringing to an infinite loop. Obviously we could skip loop as done in the GT but this bring to incorrect results, and also limits the number of times the loops are traversed would not be a correct approach, cause each loop distort inventory input.

So far the only thing I could come up with that at least gives a result that is the same of static LCA is to apply the approach for static database also in the loops (i.e. when a node is found a second time just characterize as a static one). You can see a very simple approach here (look at the code circled with hashes) While this is fine in terms of cumulative LCA results, creates a distorted temporal distribution......(in case of loops this should be propagated in time) .

I could not come up for now with any other solution, do you have any better idea on how to deal with this?

P.S: by the way, made several changes that will pull that sensibly improve performance and makes possible to use both relative and absolute datetimes