make possible to redo dynamic LCA for same db without redoing LCI

Issue #2 new
giuseppe cardellini
created an issue

In situation like mine when there are several dynamic LCA to do for the same db but different FU would be nice to have the possibility to traverse and characterize the same db for different FUs without having to redo the static LCA (or LCI if the method changes) every time that should bring to a sensible improvement in speed (). to make it possible also the graph traversal need to be able to retraverse the same db. I drafted something, certainly not stylistically perfect but that seems to work (you have to tell if something is wrong, I do not know all the details of how the traversal works )

-redo graph traversal with same db same method:

-redo graph traversal with same db different method:

maybe instead of doing the new method rebuild_lca_new_method, better to check if the method changes inside rebuild_lca (please if switch_method is the correct method to use):

-redo dynamic LCA for same db:

what do you think about the idea and this tentative implementation? let me know and if ok I will pull it.

P.S: attached a profile of a loop of three dynamic LCA with the code as they are now