graph
graph copied to clipboard
Why the implementation of Lengauer-Tarjan uses std::deque for a bucket?
I was going through the implementation of the Lengauer-Tarjan algorithm in BGL's domibator_tree.hpp and have found that there is a vector of std::deque to store buckets: vertices with the given semidominator. https://github.com/boostorg/graph/blob/5557ccf92147731eb02fcd8254b451a29b111348/include/boost/graph/dominator_tree.hpp#L198
I read the original paper as well as some explanations carefully and found nowhere that the order of procesding buckets[parent[w]]
makes any sense. Moreover, I see the deque is used there just as a container, not as a backend for the std::queue
adapter: the code pushes vertices at the back of the deque, walks through the deque with a corresponding iterators and then clears it. In my understanding, std::vector<std::vector<>> might be used there.
Could you tell me why the deque is used to store a bucket in the code? My idea is to eliminate an overhead for the vector reallocation during the repeatedly performed push_back()
and clear()
operations, so this is a technical thing only and has no impact on the correctness of the algorithm.
Thank you very much.