multiple files
This commit is contained in:
parent
ae61cb3da0
commit
205510533c
2 changed files with 50 additions and 50 deletions
5
rank.js
5
rank.js
|
@ -68,9 +68,12 @@ function rankCalc(result, iterations = 10, main = [], domain_mode = false) {
|
||||||
matrixe[n] = 1.1 + 1 / (dst + 3);
|
matrixe[n] = 1.1 + 1 / (dst + 3);
|
||||||
msum_old += matrixe[n];
|
msum_old += matrixe[n];
|
||||||
}
|
}
|
||||||
|
if (main.indexOf(unn) != -1) {
|
||||||
|
matrixe[(keys.indexOf(unn) || 0) * (rl+1)] *= 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mm = (process.env.matrixIterations || iterations);
|
let mm = (iterations);
|
||||||
|
|
||||||
let gpu = new GPU();
|
let gpu = new GPU();
|
||||||
const multiplyMatrix = gpu.createKernel(function (a, b, c) {
|
const multiplyMatrix = gpu.createKernel(function (a, b, c) {
|
||||||
|
|
29
site.js
29
site.js
|
@ -241,14 +241,13 @@ async function siteCollector(user, path, site, useLimit, data2) {
|
||||||
|
|
||||||
users = [...new Set(users)];
|
users = [...new Set(users)];
|
||||||
|
|
||||||
for (let i = 1; i < d; i++) {
|
let dat;
|
||||||
let tempSet = [...users];
|
for (let i = 0; i < d; i++) {
|
||||||
|
if (i != 0) {
|
||||||
|
let tempSet = dat.map(x => x[0]);
|
||||||
users = await rounder(tempSet, data, true);
|
users = await rounder(tempSet, data, true);
|
||||||
users = [...new Set(users)];
|
users = [...new Set(users)];
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Graph is fully downloaded (${Object.keys(users).length} entries)`);
|
|
||||||
|
|
||||||
for (let uf of users) {
|
for (let uf of users) {
|
||||||
let u = data[uf];
|
let u = data[uf];
|
||||||
if (!u) continue;
|
if (!u) continue;
|
||||||
|
@ -281,23 +280,21 @@ async function siteCollector(user, path, site, useLimit, data2) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let a in data) {
|
|
||||||
if (users.indexOf(a) == -1) {
|
|
||||||
delete data[a];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Graph is fully repaired`);
|
console.log(`Graph is fully repaired`);
|
||||||
let dat = Object.entries(rankCalc(data, 100, penv, site == 'url'));
|
dat = Object.entries(rankCalc(data, (i == d - 1) ? process.env.matrixIterations : 3, penv, site == 'url'));
|
||||||
dat = dat.sort((a, b) => b[1] - a[1]);
|
dat = dat.sort((a, b) => b[1] - a[1]);
|
||||||
|
console.log(`Graph is calculated`);
|
||||||
let dat2 = {};
|
let dat2 = {};
|
||||||
for (let d of dat) {
|
for (let d of dat) {
|
||||||
dat2[d[0]] = d[1] * 100 + "%";
|
dat2[d[0]] = d[1] * 100 + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
let srz = JSON.stringify(dat2);
|
let srz = JSON.stringify(dat2);
|
||||||
console.log(`Data is calculated`);
|
let ff = `./users_${i}.json`;
|
||||||
await writeFile(`./users.json`, srz, 'utf8');
|
await writeFile(ff, srz, 'utf8');
|
||||||
console.log(`Everything is done`);
|
console.log(`Temporary file ${ff} is written`);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`Graph is complete (${Object.keys(users).length} entries)`);
|
||||||
|
|
||||||
})()
|
})()
|
||||||
|
|
Loading…
Reference in a new issue