cech-complex
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "cech-complex", | ||
"version": "1.0.0", | ||
"authors": [ | ||
"git@bitbucket.org" | ||
"version": "1.0.1", | ||
"description": "Cech complex builder", | ||
"main": "./lib/cech.js", | ||
"directories": { | ||
"example": "example", | ||
"test": "test" | ||
}, | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/LukaszKrawczyk/cech-complex.git" | ||
}, | ||
"keywords": [ | ||
"cech", | ||
"complex", | ||
"topology" | ||
], | ||
"description": "Cech complex builder", | ||
"main": "dist/cech.js", | ||
"authors": { | ||
"name": "Lukasz Krawczyk" | ||
}, | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/LukaszKrawczyk/cech-complex/issues" | ||
}, | ||
"homepage": "https://github.com/LukaszKrawczyk/cech-complex", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
"bower_components" | ||
] | ||
} |
@@ -54,12 +54,12 @@ /** | ||
var S1 = []; | ||
var i; | ||
var j; | ||
this.neighbors = this.cells.map(function fn() { | ||
return []; | ||
}); | ||
this.neighbors = []; | ||
for (i = 0; i < (this.N - 1); i++) { | ||
for (i = 0, l = this.cells.length; i < l; i++) { | ||
this.neighbors.push([]); | ||
for (j = i + 1; j < this.N; j++) { | ||
} | ||
for (var i = 0, l = this.N - 1; i < l; i++) { | ||
this.neighbors.push([]); | ||
for (var j = i + 1; j < this.N; j++) { | ||
if (this.intersects(this.cells[i], this.cells[j])) { | ||
@@ -128,7 +128,11 @@ S1.push([i, j]); | ||
var k = u.length; | ||
var uCells = []; | ||
var i; | ||
var j; | ||
var uCells = u.map(function getCell(id) { | ||
return this.cells[id]; | ||
}.bind(this)); | ||
var l; | ||
for (i = 0; i < k; i++) { | ||
uCells.push(this.cells[u[i]]); | ||
} | ||
var smallest = this.getSmallestCell(uCells); | ||
@@ -152,3 +156,3 @@ | ||
var X = []; | ||
for (i = 0; i < k - 1; i++) { | ||
for (i = 0, l = k - 1; i < l; i++) { | ||
for (j = 1; j < k; j++) { | ||
@@ -167,3 +171,3 @@ var inter = this.intersection(uCells[i], uCells[j]); | ||
var exists = true; | ||
var j = uCells.length; | ||
j = uCells.length; | ||
while (j--) { | ||
@@ -192,4 +196,6 @@ var cell = uCells[j]; | ||
var minCell = null; | ||
var cell; | ||
cells.forEach(function fn(cell) { | ||
for (var i = 0, l = cells.length; i < l; i++) { | ||
cell = cells[i]; | ||
if (cell[1] < min) { | ||
@@ -199,3 +205,3 @@ min = cell[1]; | ||
} | ||
}); | ||
} | ||
@@ -206,25 +212,17 @@ return minCell; | ||
/** | ||
* get neighbors for each cell | ||
* get candidates for a k-simplex | ||
* | ||
* @param {Array} S | ||
* @param {Array} neighbors | ||
* @param {number} v | ||
* @param {number} k | ||
* @return {Array} | ||
*/ | ||
Cech.prototype.getNeighbors = function(S) { | ||
var neighbors = S[0].map(function fn() { | ||
return []; | ||
}); | ||
S[1].forEach(function fn(p) { | ||
neighbors[p[0]].push(p[1]); | ||
}); | ||
return neighbors; | ||
}; | ||
// get candidates for a k-simplex | ||
Cech.prototype.getCandidates = function(neighbors, v, k) { | ||
return this.combinations(neighbors[v], k) | ||
.map(function(item) { | ||
return [v].concat(item); | ||
}); | ||
var candidates = []; | ||
var comb = this.combinations(neighbors[v], k); | ||
for (var i = 0, l = comb.length; i < l; i++) { | ||
var item = comb[i]; | ||
candidates.push([v].concat(item)); | ||
} | ||
return candidates; | ||
}; | ||
@@ -231,0 +229,0 @@ |
{ | ||
"name": "cech-complex", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Cech complex builder", | ||
@@ -14,3 +14,4 @@ "main": "./lib/cech.js", | ||
"cech", | ||
"complex" | ||
"complex", | ||
"topology" | ||
], | ||
@@ -17,0 +18,0 @@ "author": "Lukasz Krawczyk <contact@lukaszkrawczyk.eu> (http://lukaszkrawczyk.eu)", |
61
21859
705