Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bipartite-matching

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bipartite-matching

Maximum unweighted bipartite matching

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

bipartite-matching

Finds a maximum bipartite matching in an unweighted graph. The current implementation uses the Hopcroft-Karp algorithm and runs in O(sqrt(V) * E + V) time. Works in both node.js and in a browser.

Example

var findMatching = require("bipartite-matching")

console.log(findMatching(5, 5, [
      [0, 0],
      [0, 1],
      [1, 0],
      [2, 1],
      [2, 2],
      [3, 2],
      [3, 3],
      [3, 4],
      [4, 4]
    ]))

Install

npm install bipartite-matching

require("bipartite-matching")(n, m, edges)

Computes a bipartite matching for the graph

  • n is the number of vertices in the first component
  • m is the number of vertices in the second component
  • edges is the list of edges, represented by pairs of integers between 0 and n-1,m-1 respectively.

Returns A list of edges representing the matching

Credits

(c) 2014 Mikola Lysenko. MIT License

Keywords

FAQs

Package last updated on 29 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc