New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dominators: Implement the Lengauer-Tarjan algorithm #182
base: master
Are you sure you want to change the base?
Conversation
Looks like rust 1.12 didn't have closure-that-doesn't-capture-to-fn-ptr yet:
|
This algorithm runs in **O(|E| log |V|)** time. This is a better theoretical running time than the "Simple, Fast" algorithm by Cooper (see `simple_fast`), but has higher start-up costs and memory requirements. The "Simple, Fast" paper reported the tipping point where the Lengauer-Tarjan algorithm outperformed theirs at CFGs with >= 30,000 vertices. Take this with a grain of salt, however, as noted in ["Finding Dominators in Practice" by Loukas Georgiadis, Robert E. Tarjan, and Renato F. Werneck][1]: > Even on small instances, however, we did not observe the clear superiority > of the ["Simple, Fast" algorithm] reported by Cooper et al., > which we attribute to their inefficient implementation of [the simple > Lengauer-Tarjan algorithm]. Note that this is an implementation of the simple version of the Lengauer-Tarjan algorithm. There is another version that has an even better theoretical running time of **O(|E| α(|E|, |V|))** where **α** is a functional inverse of Ackermann's function. However, "Finding Dominators in Practice" found it to be slower than the simpler version for all graphs they tested: > Both versions of the Lengauer-Tarjan algorithm (LT [the advanced version]) > and (SLT [the simple version]) are more robust [than the "Simple, > Engineered" algorithm] on application graphs, and the advantage increases > with graph size or graph complexity. Among these three, LT was the slowest, > in contrast with the results reported by Lengauer and Tarjan [30]. SLT and > [yet another dominators algorithm] were the most consistently fast > algorithms in practice; since the former is less sensitive to pathological > instances, we think it should be preferred where performance guarantees > are important. [0]: http://www.cs.princeton.edu/courses/archive/spr03/cs423/download/dominators.pdf [1]: http://jgaa.info/accepted/2006/GeorgiadisTarjanWerneck2006.10.1.pdf
557063d
to
6e57f2b
Compare
(And the reason this isn't just passing the |
I won't be able to review this in depth, but:
|
Yep! They have identical signatures. |
Hi -- I haven't had the time to come back to this yet. Feel free to ping me later. |
Like #178, I don't really have the bandwidth to review. But it would be cool if contributors reviewed each other's work. |
Maybe make a dedicated issue seeking more co-maintainers and cc folks who have contributed in the past? Niko recently did that with Personally, I'd also be happy to help. Since |
Word. |
Yes, petgraph needs a team. It is only at 0.4.x and has much to do.
|
TODO note for myself:
|
@fitzgen Would you like to revisit this and we can work on getting it landed for 0.5? |
I second this, it is very common algorithm and would be nice to have it out of the box. But it needs more tests than provided. And having quickcheck would help too. |
FWIW, we also have the simple-fast algorithm already in petgraph, so it isn't like there is a giant missing whole IMHO.
Unfortunately, I don't think I have the time right now, despite how much I wish that I did :( |
Anyone who really wants this algorithm in petgraph: please take over this PR! You have my blessing :) |
94094ae
to
8503e45
Compare
An implementation of the algorithm from "A Fast Algorithm for Finding Dominators in a Flowgraph" by Thomas Lengauer and Robert E. Tarjan.
This algorithm runs in O(|E| log |V|) time. This is a better theoretical running time than the "Simple, Fast" algorithm by Cooper (see
simple_fast
), but has higher start-up costs and memory requirements. The "Simple, Fast" paper reported the tipping point where the Lengauer-Tarjan algorithm outperformed theirs at CFGs with >= 30,000 vertices. Take this with a grain of salt, however, as noted in "Finding Dominators in Practice" by Loukas Georgiadis, Robert E. Tarjan, and Renato F. Werneck:Note that this is an implementation of the simple version of the Lengauer-Tarjan algorithm. There is another version that has an even better theoretical running time of O(|E| α(|E|, |V|)) where α is a functional inverse of Ackermann's function. However, "Finding Dominators in Practice" found it to be slower than the simpler version for all graphs they tested:
r? @bluss
cc @m4b