@hexlet/graphs

0.3.2 • Public • Published

js-graphs

github action status

Install

npm install @hexlet/graphs

Usage example

import {
  makeJoints, buildTreeFromLeaf, sortTree,
} from '@hexlet/graphs';

const tree = ['B', [
  ['D'],
  ['A', [
    ['C', [
      ['F'],
      ['E'],
    ]],
  ]],
]];

const joints = makeJoints(tree);
const transformed = buildTreeFromLeaf(joints);
// ['C', [
//   ['F'],
//   ['E'],
//   ['A', [
//     ['B', [
//       ['D'],
//     ]],
//   ]],
// ]];

sortTree(transformed);
// ['C', [
//   ['A', [
//     ['B', [
//       ['D'],
//     ]],
//   ]],
//   ['E'],
//   ['F'],
// ]];

For more information, see the Full Documentation

Hexlet Ltd. logo

This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet (in Russian).

Readme

Keywords

none

Package Sidebar

Install

npm i @hexlet/graphs

Weekly Downloads

0

Version

0.3.2

License

ISC

Unpacked Size

17.1 kB

Total Files

11

Last publish

Collaborators

  • dzencot
  • grozwalker
  • mshkv
  • mokevnin
  • corsicanec82