1.0.1 • Published 3 years ago

@seregpie/bron-kerbosch v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

BronKerbosch

BronKerbosch(edges)

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

argumentdescription
edgesAn 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