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

bipartite-vertex-cover

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bipartite-vertex-cover

Minimal vertex cover for bipartite graphs

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
Maintainers
1
Weekly downloads
 
Created
Source

bipartite-vertex-cover

Computes a minimum vertex cover of a bipartite graph. Internally, this implementation uses the Hopcroft-Karp algorithm and Konig's theorem to compute the minimal vertex cover of a bipartite graph in O(sqrt(V) * E) time. This code works in both node.js and in a modern browser via browserify.

Example

var findCover = require("bipartite-vertex-cover")

var cover = findCover(4, 4, [
    [0, 1],
    [1, 0],
    [1, 1],
    [1, 2],
    [2, 1],
    [3, 2],
    [3, 3]
    ])

// Cover = [ [3, 1], [1] ]

Install

npm install bipartite-vertex-cover

require("bipartite-vertex-cover")(n, m, edges)

Finds a minimal vertex cover for a bipartite graph.

  • n is the number of vertices in the left component
  • m is the number of vertices in the right component
  • edges is a list of edges from the left component connecting to the right component represented by pairs of integers between 0 and n-1,m-1 respectively

Returns A pair of lists representing the vertices in the left component and the right component respectively which are in the cover.

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