@partial-order/poset

Partially ordered sets algorithms for JavaScript.

Usage no npm install needed!

<script type="module">
  import partialOrderPoset from 'https://cdn.skypack.dev/@partial-order/poset';
</script>

README

:spider_web: @partial-order/poset

Distributive lattice of the divisors of 120
User:David_Eppstein / Public Domain

Partially ordered sets algorithms for JavaScript. See docs. Parent is js-algorithms.

import {minima} from '@partial-order/poset';
import {increasing} from '@total-order/primitive';

const a = [4, 12, 2, 6, 3];

const divides = (a, b) => b % a === 0;
const n = minima(divides, a, 0, a.length); // 2
a.slice(0, n).sort(increasing); // 2 3

const norel = (_a, _b) => false;
minima(norel, a, 0, a.length); // a.length

License Version Tests Dependencies Dev dependencies GitHub issues Downloads

Code issues Code maintainability Code coverage (cov) Code technical debt Documentation Package size