toposource
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

toposource

CI Maintainability Test Coverage

Directed graphs analyzer for parallel traversals

Usage

import { analyze } from 'toposource'

analyze([['a', 'b'], ['b', 'c'], ['d', 'c'], ['e', 'f']])
// →
{
  next: new Map([
    ['a', ['b']],
    ['b', ['c']],
    ['d', ['c']],
    ['e', ['f']]
  ]),
  prev: new Map([
    ['b', ['a']],
    ['c', ['b', 'd']],
    ['f', ['e']]
  ]),
  sources: [ 'a', 'd', 'e' ],
  queue: ['a', 'd', 'e', 'b', 'c', 'f'],
  graphs: [{
    sources: ['a', 'd'],
    nodes: new Set(['a', 'b', 'd', 'c'])
  }, {
    sources: ['e'],
    nodes: new Set(['e', 'f'])
  },
}

Alternatives

License

MIT

Package Sidebar

Install

npm i toposource

Weekly Downloads

5,122

Version

1.2.0

License

MIT

Unpacked Size

23 kB

Total Files

10

Last publish

Collaborators

  • semrel-extra-bot