Version tracking data structure

npm install version-tree
7 downloads in the last month


A data structure for maintaining a tree of versions. This can be useful when implementing fully persistent data structures using the DTSS method. Works in both node.js and browserify. All operations use amortized O(1) space and time.


var createVersionTree = require("version-tree")

//Create a new tree
var root = createVersionTree()

//Create two subversions
var a = root.fork()
var b = root.fork()

//Compare root to children
console.log(root.subversion(a), root.subversion(b), a.subversion(root), b.subversion(a))
// Prints out:
//  true    true    false   false

//Make a child version of a
var c = a.fork()
console.log(root.subversion(c), a.subvsersion(c), b.subversion(c))
//Prints out:
//    true    true    false


npm install version-tree


var createVersionTree = require("version-tree")

var tree = createVersionTree()

Creates a new version tree with one root version


Creates a new subversion of tree.

Returns A new version which inherits from tree


Tests if other is a subversion of tree.

Returns true if other is an ancestor of tree, false otherwise


(c) 2013 Mikola Lysenko. MIT License

npm loves you