randomized-hopcroft-karp
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Randomized Hopcroft-Karp

Install

npm install randomized-hopcroft-karp

Usage

function findMatching(
  m: number,
  n: number,
  edges: [number, number][],
  groups?: number[]
): [number, number][];
  • m: Number of nodes U.
  • n: Number of nodes V.
  • edges: Edges between U and V.
  • groups: Groups which nodes U belong to. The algorithm tries to maximize cardinality of chosen groups.
  • Returns an array of edges representing the matching.

Example

import findMatching from "randomized-hopcroft-karp";

const matching = findMatching(3, 4, [
  [0, 0],
  [0, 1],
  [1, 1],
  [1, 2],
  [2, 1],
  [2, 3],
]);

Package Sidebar

Install

npm i randomized-hopcroft-karp

Weekly Downloads

4

Version

0.2.0

License

MIT

Unpacked Size

7.3 kB

Total Files

7

Last publish

Collaborators

  • slaypni