# @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

`EncodedPoset`

: see @kingjs/poset`VertexProperties`

: see @kingjs/poset`AdjacencyList`

: see @kingjs/poset### 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