Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphology-indices

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphology-indices - npm Package Compare versions

Comparing version 0.6.3 to 0.6.4

148

neighborhood/louvain.js

@@ -133,3 +133,3 @@ /**

var i, l, node, neighbor, weight;
var i, l, node, neighbor, adj, edge, weight;

@@ -141,41 +141,40 @@ var n = 0;

var self = this;
for (i = 0, l = graph.order; i < l; i++) {
node = this.nodes[i];
function edgeCallback(edge, attr, source, target) {
neighbor = node === source ? target : source;
weight = getWeight(attr);
this.starts[i] = n;
this.belongings[i] = i;
// Self loops
if (node === neighbor) {
self.E -= 2;
self.M += weight;
self.totalWeights[i] += weight * 2;
self.internalWeights[i] += weight * 2;
self.loops[i] = weight * 2;
}
else {
if (keepCounts)
this.counts[i] = 1;
// Doing only once per edge
if (node < neighbor)
self.M += weight;
// TODO: this should be generalized when different implementations are used
adj = graph._nodes.get(node).undirected;
self.totalWeights[i] += weight;
for (neighbor in adj) {
edge = adj[neighbor];
weight = getWeight(edge.attributes);
self.neighborhood[n] = ids[neighbor];
self.weights[n] = weight;
// Self loops
if (node === neighbor) {
this.E -= 2;
this.M += weight;
this.totalWeights[i] += weight * 2;
this.internalWeights[i] += weight * 2;
this.loops[i] = weight * 2;
}
else {
n++;
}
}
// Doing only once per edge
if (node < neighbor)
this.M += weight;
for (i = 0, l = graph.order; i < l; i++) {
node = this.nodes[i];
this.totalWeights[i] += weight;
this.starts[i] = n;
this.belongings[i] = i;
this.neighborhood[n] = ids[neighbor];
this.weights[n] = weight;
if (keepCounts)
this.counts[i] = 1;
graph.forEachEdge(node, edgeCallback);
n++;
}
}
}

@@ -599,3 +598,3 @@

var i, l, node, neighbor, weight;
var i, l, node, neighbor, adj, edge, weight;

@@ -607,59 +606,58 @@ var n = 0;

var self = this;
for (i = 0, l = graph.order; i < l; i++) {
node = this.nodes[i];
function outEdgeCallback(edge, attr, source, target) {
neighbor = target;
weight = getWeight(attr);
// Starting with outgoing edges
this.starts[i] = n;
this.belongings[i] = i;
// Self loops
if (node === neighbor) {
self.E -= 2;
self.M += weight;
self.internalWeights[i] += weight;
self.loops[i] += weight;
self.totalInWeights[i] += weight;
self.totalOutWeights[i] += weight;
}
else {
self.M += weight;
self.totalOutWeights[i] += weight;
self.totalInWeights[ids[neighbor]] += weight;
if (keepCounts)
this.counts[i] = 1;
self.neighborhood[n] = ids[neighbor];
self.weights[n] = weight;
// TODO: this should be generalized when different implementations are used
adj = graph._nodes.get(node).out;
n++;
}
}
for (neighbor in adj) {
edge = adj[neighbor];
weight = getWeight(edge.attributes);
function inEdgeCallback(edge, attr, source) {
neighbor = source;
// Self loops
if (node === neighbor) {
this.E -= 2;
this.M += weight;
this.internalWeights[i] += weight;
this.loops[i] += weight;
this.totalInWeights[i] += weight;
this.totalOutWeights[i] += weight;
}
else {
this.M += weight;
this.totalOutWeights[i] += weight;
this.totalInWeights[ids[neighbor]] += weight;
if (node === neighbor)
return;
this.neighborhood[n] = ids[neighbor];
this.weights[n] = weight;
weight = getWeight(attr);
n++;
}
}
self.neighborhood[n] = ids[neighbor];
self.weights[n] = weight;
// Recording offset and continuing with ingoing edges
this.offsets[i] = n;
n++;
}
adj = graph._nodes.get(node).in;
for (i = 0, l = graph.order; i < l; i++) {
node = this.nodes[i];
for (neighbor in adj) {
edge = adj[neighbor];
// Starting with outgoing edges
this.starts[i] = n;
this.belongings[i] = i;
if (node === neighbor)
return;
if (keepCounts)
this.counts[i] = 1;
weight = getWeight(edge.attributes);
graph.forEachOutEdge(node, outEdgeCallback);
this.neighborhood[n] = ids[neighbor];
this.weights[n] = weight;
// Recording offset and continuing with ingoing edges
this.offsets[i] = n;
graph.forEachInEdge(node, inEdgeCallback);
n++;
}
}

@@ -666,0 +664,0 @@

{
"name": "graphology-indices",
"version": "0.6.3",
"version": "0.6.4",
"description": "Miscellaneous indices for graphology.",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc