18.1.14 • Published 6 years ago

almete.bronkerbosch v18.1.14

Weekly downloads
1,007
License
MIT
Repository
github
Last release
6 years ago

almete.BronKerbosch

almete.BronKerbosch(edges)

Implementation of Bron-Kerbosch algorithm to find maximal cliques in an undirected graph. This algorithm variant uses pivoting and a modification developed by Tomita.

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

Returns maximal cliques as an array of arrays.

dependencies

no dependencies

setup

npm

npm install almete.bronkerbosch

ES module

import BronKerbosch from 'almete.bronkerbosch';

Node

const BronKerbosch = require('almete.bronkerbosch');

browser

<script src="https://unpkg.com/almete.bronkerbosch"></script>

The function BronKerbosch will be available under the namespace almete.

Include polyfills to support older browsers.

<script src="https://cdn.polyfill.io/v2/polyfill.min.js"></script>

usage

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

see also