bfsearch

1.1.0 • Public • Published

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
        }
      ]
    }
  ]
}

Package Sidebar

Install

npm i bfsearch

Weekly Downloads

1

Version

1.1.0

License

MIT

Unpacked Size

1.13 kB

Total Files

3

Last publish

Collaborators

  • alanfriedman