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);
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();
const multiplyMatrix = gpu.createKernel(function (a, b, c) {

93
site.js
View file

@ -241,63 +241,60 @@ async function siteCollector(user, path, site, useLimit, data2) {
users = [...new Set(users)];
for (let i = 1; i < d; i++) {
let tempSet = [...users];
users = await rounder(tempSet, data, true);
users = [...new Set(users)];
}
let dat;
for (let i = 0; i < d; i++) {
if (i != 0) {
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) {
let u = data[uf];
if (!u) continue;
let { following, followers } = u;
if (!following || !followers) continue;
if (followers.indexOf(o) == -1) {
followers.push(o)
}
}
} catch (err) {
}
try {
if (site == 'url') {
let o = new URL(new URL(uf).origin).toString();
if (followers.indexOf(o) == -1) {
followers.push(o)
for (let f of followers) {
if (!data[f]) data[f] = { followers: [] };
if (!data[f].following) data[f].following = [];
if (data[f].following.indexOf(uf) == -1) {
data[f].following.push(uf);
}
}
} catch (err) {
}
for (let f of followers) {
if (!data[f]) data[f] = { followers: [] };
if (!data[f].following) data[f].following = [];
if (data[f].following.indexOf(uf) == -1) {
data[f].following.push(uf);
for (let f of following) {
if (!data[f]) data[f] = { following: [] };
if (!data[f].followers) data[f].followers = [];
if (data[f].followers.indexOf(uf) == -1) {
data[f].followers.push(uf);
}
}
}
for (let f of following) {
if (!data[f]) data[f] = { following: [] };
if (!data[f].followers) data[f].followers = [];
if (data[f].followers.indexOf(uf) == -1) {
data[f].followers.push(uf);
}
console.log(`Graph is fully repaired`);
dat = Object.entries(rankCalc(data, (i == d - 1) ? process.env.matrixIterations : 3, penv, site == 'url'));
dat = dat.sort((a, b) => b[1] - a[1]);
console.log(`Graph is calculated`);
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) {
if (users.indexOf(a) == -1) {
delete data[a];
}
}
console.log(`Graph is complete (${Object.keys(users).length} entries)`);
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`);
})()