@kingjs/poset.decode

Decodes a descriptor representing a poset into an adjacency list and a vertex property map.

Stats

StarsIssuesVersionUpdatedCreatedSize
@kingjs/poset.decode
1.0.103 years ago3 years agoMinified + gzip package size for @kingjs/poset.decode in KB

Readme

@kingjs/poset.decode

Decodes a descriptor representing a poset into an adjacency list and a vertex property map.

Usage

Decode an encoded poset with exported vertices 'a', 'b', and 'c' where vertex 'a' has value 1, and depends on vertices 'b' and 'c' which have values 2 and 3 respectively, and both depend on 'd' which has value 4, like this:

var decode = require('@kingjs/poset.decode');

var vertices = { };
//   a=1
//   / \
// b=2 c=3
//   \ /
//   d=4
var result = {
  edges: decode.call({
    a$b$c: 1,
    b$d: 2,
    c$d: 3,
    d: 4,
  }, vertices),
  
  vertices: vertices
}

result:

{
  edges: {
    a: [ 'b', 'c' ],
    b: [ 'd' ],
    c: [ 'd' ]
  },

  vertices: {
    a: 1,
    b: 2,
    c: 3,
    d: 4
  }
}

API

declare function decode(
  this: EncodedPoset,
  vertices: VertexProperties
): AdjacencyList

Interfaces

  • EncodedPoset: see @kingjs/poset
  • VertexProperties: see @kingjs/poset
  • AdjacencyList: see @kingjs/poset

    Parameters

  • this: An encoded poset.
  • vertices: A out descriptor augmented with vertex properties.

    Returns

    An descriptor with a property for every vertex that has adjacent vertices. Each property value is an array of names of the adjacent vertices.

    Install

    With npm installed, run
    $ npm install @kingjs/poset.decode
    

    License

    MIT

Analytics

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.