Socket
Socket
Sign inDemoInstall

planar-dual

Package Overview
Dependencies
10
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    planar-dual

Find the faces of a planar graph


Version published
Weekly downloads
93K
increased by39.47%
Maintainers
1
Install size
70.6 kB
Created
Weekly downloads
 

Readme

Source

planar-dual

Given a planar embedding of a graph, find all faces.

Example

var getFaces = require("planar-dual")

//Create a triforce
var positions = [
  [0, 0],
  [-1, -1],
  [0, 1],
  [1, -1]
]
var edges = [
  [1, 2],
  [2, 3],
  [3, 1],
  [0, 1],
  [0, 2],
  [0, 3]
]

//Compute dual graph
console.log(getFaces(edges, positions))

Output:

[ [ 0, 1, 2 ], [ 0, 2, 3 ], [ 0, 3, 1 ], [ 1, 3, 2 ] ]

Install

npm install planar-dual

API

require("planar-dual")(edges, positions)

Splits an embedded planar graph into a collection of faces

  • edges are the edges of the graph
  • positions are the locations of the vertices of the graph

Returns A list of faces of the graph represented as ordered lists of vertices

Credits

(c) 2014 Mikola Lysenko. MIT License

Keywords

FAQs

Last updated on 29 Apr 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc