Skip to content

alanfriedman/bfsearch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

bfsearch

Breadth-first search a tree

Usage

const bfsearch = require('bfsearch');

bfsearch(tree, node => {
  // Called with each node
});

Tree

  • should look like this
  • nodes may have a children array of other nodes
  • nodes may have any other properties
{
  id: 1,
  children: [
    {
      id: 2,
      children: [
        {
          id: 3
        }
      ]
    }
  ]
}

Releases

No releases published

Packages

No packages published