recursion - Processing graph layer by layer -


i have task. let's imagine have tree. have trunk , branches. every branch has own branches. etc. simplify task suppose every branch has 2 branches on it. see picture.

enter image description here

we want address every branch, have layer layer. mean @ first should address branches 1 , 2, after 3,4,5,6, , forth. tried make algorythm it, anytime ends recursively going deeply: 1-3-7-8-4-9-10... there algorithms process tree unknown size without boilerplate code?

you can breadth-first search, goes through graph layer layer because uses queue store newly discovered nodes.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -