npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

afsolver

v0.1.1

Published

Lightweight solver for Dung-style argumentation framework semantics (conflict-free, admissible, complete, preferred, grounded, stable extensions)

Downloads

150

Readme

afsolver

A lightweight TypeScript solver for Dung-style abstract argumentation framework (AF) semantics: conflict-free, admissible, complete, preferred, grounded, and stable.

This is the TypeScript sibling of the Python afsolver package — same algorithms, same test cases, ported 1:1.

Install

bun add afsolver

or with npm/pnpm/yarn:

npm install afsolver

Quick start

import { ArgumentationFramework } from "afsolver";

const af = new ArgumentationFramework(
  ["a", "b", "c"],
  [["a", "b"], ["b", "a"], ["c", "b"]], // a<->b mutual attack, c attacks b
);

af.preferred();   // [Set {'a', 'c'}]
af.grounded();    // Set {'a', 'c'}
af.extensions();  // object with all six semantics at once

Arguments are optional — if omitted, they're inferred from the attacks pairs:

const af = new ArgumentationFramework([], [["b", "a"], ["c", "b"], ["d", "c"]]);
af.arguments; // ['b', 'a', 'c', 'd']

API

new ArgumentationFramework(arguments = [], attacks = [])

| Method | Returns | |---|---| | .conflictFree() | ReadonlySet<string>[] — conflict-free sets | | .admissible() | ReadonlySet<string>[] — admissible sets | | .complete() | ReadonlySet<string>[] — complete extensions | | .preferred(contains?) | ReadonlySet<string>[] — preferred (maximal admissible) extensions, optionally restricted to those containing all arguments in contains | | .grounded() | ReadonlySet<string> — the (unique) grounded extension | | .stable() | ReadonlySet<string>[] — stable extensions | | .minimalAdmissible(contains?) | ReadonlySet<string>[] — non-empty admissible sets minimal by set inclusion, optionally restricted to those containing all arguments in contains | | .extension(name) | dispatch to any of the six semantics above by string name | | .extensions() | object with all six semantics computed at once |

preferred

With no contains argument, returns all preferred extensions. Pass contains to restrict the result to only those that include a given argument (or set of arguments):

const af = new ArgumentationFramework(
  ["a", "b", "c", "d", "e"],
  [["b", "a"], ["c", "b"], ["d", "b"], ["c", "e"], ["e", "c"]],
);

af.preferred();              // [{'a', 'c', 'd'}, {'a', 'd', 'e'}]
af.preferred(["a", "c"]);    // [{'a', 'c', 'd'}]

minimalAdmissible

With no contains argument, returns the smallest non-trivial admissible sets overall. Pass contains to restrict the result to the smallest admissible sets that include a given argument (or set of arguments):

const af = new ArgumentationFramework(
  ["a", "b", "c", "d", "e"],
  [["b", "a"], ["c", "b"], ["d", "b"], ["c", "e"], ["e", "c"]],
);

af.minimalAdmissible();          // [{'c'}, {'d'}, {'e'}]
af.minimalAdmissible(["a"]);     // [{'a', 'c'}, {'a', 'd'}]

The empty set is always excluded — it's trivially admissible and a subset of everything else, so including it would hide the smallest non-trivial results.

Development

bun install         # install dependencies
bun test            # run tests
bun run typecheck   # tsc --noEmit
bun run build       # emit dist/ (esm + .d.ts)