@seregpie/bron-kerbosch
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

BronKerbosch

BronKerbosch(edges)

An implementation of the Bron-Kerbosch algorithm to find the maximal cliques in an undirected graph.

argument description
edges An iterable of the edges to build the graph from. An edge is an array of two nodes.

Returns the maximal cliques as an array of arrays.

setup

npm

npm i @seregpie/bron-kerbosch

Import inside an ES module.

import BronKerbosch from '@seregpie/bron-kerbosch';

or

Import inside a CommonJS module.

let BronKerbosch = require('@seregpie/bron-kerbosch');

browser

<script src="https://unpkg.com/@seregpie/bron-kerbosch"></script>

The module is globally available as BronKerbosch.

usage

let edges = [[6, 4], [4, 3], [4, 5], [5, 2], [5, 1], [1, 2]];
let cliques = BronKerbosch(edges);
// => [[4, 6], [4, 3], [4, 5], [2, 5, 1]]

see also

Readme

Keywords

none

Package Sidebar

Install

npm i @seregpie/bron-kerbosch

Weekly Downloads

8

Version

1.0.1

License

MIT

Unpacked Size

3.85 kB

Total Files

5

Last publish

Collaborators

  • seregpie