uhho / cech-complex

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cech complex in JavaScript

Small library for building generalized Cech Complex as described in the following paper: "Construction of the generalized Cech complex" by Ngoc Khuyen Le, Philippe Martins, Laurent Decreusefond, Anais Vergne.

Generalized Cech Comples is a "good cover" where each cell has different radius (as opposed to standard Cech complex, where radius is always the same). This approach is very useful for analysing coverage of wireless networks, sensors, etc.

Installation

npm install cech-complex

or in browser

bower install cech-complex

Usage

var Cech = require('cech-complex');
var cech = new Cech();

var cells = [
  [[0, 0], 10], // [ [x, y], radius ]
  [[1, 1], 10],
  // ...
];

var simplices = cech.complex(cells);
/*
[
  [[0], [1], ... ], // 0-simplex (points)
  [[0,1], [0,5], ...], // 1-simplex (edges)
  [[0,1,5], [0,1,9], ...], // 2-simplex (triangles)
  ... // 3-simplex (tetrahedrons)
]
*/

For faster computation you can limit the number of simplices dimensions:

var simplices = cech.comples(cells, 2); // build up to 2-simplex

Test

To test, install mocha globally and run following command:

npm test

Future releases

  • computing vertices index
  • cycles and boundaries
  • betti numbers

About


Languages

Language:JavaScript 93.8%Language:HTML 6.2%