multiple files

This commit is contained in:
biglyderv 2025-02-01 10:17:59 -05:00
parent ae61cb3da0
commit 205510533c
2 changed files with 50 additions and 50 deletions

View file

@ -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) {

95
site.js
View file

@ -241,63 +241,60 @@ 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++) {
users = await rounder(tempSet, data, true); if (i != 0) {
users = [...new Set(users)]; let tempSet = dat.map(x => x[0]);
} users = await rounder(tempSet, data, true);
users = [...new Set(users)];
}
for (let uf of users) {
let u = data[uf];
if (!u) continue;
let { following, followers } = u;
if (!following || !followers) continue;
console.log(`Graph is fully downloaded (${Object.keys(users).length} entries)`); try {
if (site == 'url') {
let o = new URL(new URL(uf).origin).toString();
for (let uf of users) { if (followers.indexOf(o) == -1) {
let u = data[uf]; followers.push(o)
if (!u) continue; }
let { following, followers } = u; }
if (!following || !followers) continue; } catch (err) {
}
try { for (let f of followers) {
if (site == 'url') { if (!data[f]) data[f] = { followers: [] };
let o = new URL(new URL(uf).origin).toString(); if (!data[f].following) data[f].following = [];
if (data[f].following.indexOf(uf) == -1) {
if (followers.indexOf(o) == -1) { data[f].following.push(uf);
followers.push(o)
} }
} }
} catch (err) { for (let f of following) {
} if (!data[f]) data[f] = { following: [] };
if (!data[f].followers) data[f].followers = [];
for (let f of followers) { if (data[f].followers.indexOf(uf) == -1) {
if (!data[f]) data[f] = { followers: [] }; data[f].followers.push(uf);
if (!data[f].following) data[f].following = []; }
if (data[f].following.indexOf(uf) == -1) {
data[f].following.push(uf);
} }
} }
for (let f of following) { console.log(`Graph is fully repaired`);
if (!data[f]) data[f] = { following: [] }; dat = Object.entries(rankCalc(data, (i == d - 1) ? process.env.matrixIterations : 3, penv, site == 'url'));
if (!data[f].followers) data[f].followers = []; dat = dat.sort((a, b) => b[1] - a[1]);
if (data[f].followers.indexOf(uf) == -1) { console.log(`Graph is calculated`);
data[f].followers.push(uf); let dat2 = {};
} for (let d of dat) {
dat2[d[0]] = d[1] * 100 + "%";
} }
let srz = JSON.stringify(dat2);
let ff = `./users_${i}.json`;
await writeFile(ff, srz, 'utf8');
console.log(`Temporary file ${ff} is written`);
} }
for (let a in data) { console.log(`Graph is complete (${Object.keys(users).length} entries)`);
if (users.indexOf(a) == -1) {
delete data[a];
}
}
console.log(`Graph is fully repaired`);
let dat = Object.entries(rankCalc(data, 100, penv, site == 'url'));
dat = dat.sort((a, b) => b[1] - a[1]);
let dat2 = {};
for (let d of dat) {
dat2[d[0]] = d[1] * 100 + "%";
}
let srz = JSON.stringify(dat2);
console.log(`Data is calculated`);
await writeFile(`./users.json`, srz, 'utf8');
console.log(`Everything is done`);
})() })()