0

I want to make a function that loops through the children of a tree breadth first.

So first, it will loop through first level of children, and then second level of children, and so on until it reaches the deepest children.

So if the function is applied to the following Parent tree:

  • Parent
    • L1_a
    • L1_b
      • L2_a
      • L2_b
    • L1_c
      • L2_c
        • L3_a

It will loop through (L1_a, L1_b, L1_c), then it will proceed to (L2_a, L2_b, L2_c), then finally to (L3_a)

How can I do this?

  • 1
    What have you tried so far? – Dan Jul 29 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.