1.0.4 • Published 2 years ago

nv-random-tree v1.0.4

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

nv-random-tree

  • nv-random-tree
  • generate a random big-tree
  • used in performance test-bed

install

  • npm install nv-random-tree

usage

   const {rand,clrp_rand} = require('nv-random-tree')

example

fast clrp_rand

slow rand

    function bigt() {
       let start = (new Date()).getTime();
       let j = rand()
       let end = (new Date()).getTime();
       console.log(end-start)
       return(j)
    }


    var big  = bigt()
    >
    2062                      // cost 2 seconds to creat 1000000 nodes
    >
    

    > big.$sdfs_.length
    1000000
    >



    
    

APIS

  • DFLT_NODE_CLS

Cfg

    > x.CLRP_CFG()
    {
      ratio: { '$append_child': 1, '$add_rsib': 5, '$add_lsib': 5, '$parent_': 1 },
      total: 500000,
      max_depth: 64,
      max_tree_size: 1000000,
      mem_ratio: 2
      Cls:DFLT_NODE_CLS
    }

  • clrp_rand(cfg:Cfg)

  • rand(max_depth = 64,max_children_count=9,max_tree_size=1000000,Cls=DFLT_NODE_CLS)

LICENSE

  • ISC