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.
npm install cech-complex
or in browser
bower install cech-complex
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-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
To test, install
mocha globally and run following command:
- computing vertices index
- cycles and boundaries
- betti numbers