Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikolalysenko/planar-dual
Given a planar embedding of a graph, decompose it into a collection of oriented cycles
https://github.com/mikolalysenko/planar-dual
Last synced: about 2 months ago
JSON representation
Given a planar embedding of a graph, decompose it into a collection of oriented cycles
- Host: GitHub
- URL: https://github.com/mikolalysenko/planar-dual
- Owner: mikolalysenko
- License: mit
- Created: 2014-04-20T22:55:40.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-29T14:06:30.000Z (over 10 years ago)
- Last Synced: 2024-10-20T14:28:16.351Z (2 months ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
planar-dual
===========
Given a planar embedding of a graph, find all faces.# Example
```javascript
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:
```javascript
[ [ 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