@kingjs/poset.encode

1.0.8 • Public • Published

@kingjs/poset.encode

Encodes properties of vertices and their adjacent vertices into a descriptor.

Usage

Encode a poset where vertex 'a' has value 1 and depends on 'b' and 'c' which have values 2 and 3 respectively, and both depend on 'd' which has value 4, like this:

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

//   a=1
//   / \
// b=2 c=3
//   \ /
//   d=4
encode.call({
  a: [ 'b', 'c' ],
  b: [ 'd' ],
  c: [ 'd' ],
}, {
  a: 1,
  b: 2,
  c: 3,
  d: 4
});

result:

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

API

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

Interfaces

Parameters

  • this: A descriptor whose properties are vertex names and whose values are vertex properties.
  • edges: A descriptor whose properties are vertex names and whose values are arrays containing the names of adjacent vertices.

Returns

Returns a descriptor whose every property name is a join by '$' of a vertex name followed by its adjacent vertices.

Install

With npm installed, run

$ npm install @kingjs/poset.encode

License

MIT

Analytics

Readme

Keywords

none

Package Sidebar

Install

npm i @kingjs/poset.encode

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

3.58 kB

Total Files

4

Last publish

Collaborators

  • kingces95