bielcardona/PhyloNetworks — pull request #2 by dscharles (2012-03-24 12:11:58+00:00)
Title: Topological restriction

Now we can just consider taxa on leaves in topological restriction.

I changed the algorithm in order to reduce the complexity from O(n log n) to O(n)

Original:

while True:
leaves_to_delete=[u for u in restricted.nodes() if \
restricted.is_leaf(u) and \
not u in restricted._labels ]

If root should be removed, then it executed at least log(n) times restricted.nodes(), which was an O(n) algorithm.