Skip to content
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

conditioniterator adds root node even if it doesn't satisfy condition #4

Open
houssamya opened this issue Sep 21, 2017 · 0 comments
Open

Comments

@houssamya
Copy link

If one calls
t.conditioniterator(n, condition)
and node n does not satisfy the condition, it will still get added to the returned list of IDs, because of the following code:


function val = recurse(node)        

        val = node;  % <--- first, node is added...

        content = obj.Node{val};

        if obj.isleaf(node) || ~condition(content) % ...THEN, the condition is checked 

            return

        else

            % bla

This only happens for the node passed as argument (the "root" of the traversal). For subsequent nodes visited in the function, they are checked before the recursive call. Which, incidentally, makes the above bolded check redundant.
So it seems the solution is to remove the redundant check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant