graphology-indices
Advanced tools
Comparing version 0.14.0 to 0.15.0
@@ -11,3 +11,2 @@ import Graph from 'graphology-types'; | ||
starts: PointerArray; | ||
stops: PointerArray; | ||
nodes: Array<string>; | ||
@@ -26,5 +25,5 @@ | ||
weights: Float64Array; | ||
outDegrees: Float64Array; | ||
neighborhood: PointerArray; | ||
starts: PointerArray; | ||
stops: PointerArray; | ||
nodes: Array<string>; | ||
@@ -31,0 +30,0 @@ |
@@ -6,2 +6,3 @@ /** | ||
var typed = require('mnemonist/utils/typed-arrays'); | ||
var createWeightGetter = require('graphology-utils/getters').createWeightGetter; | ||
@@ -12,3 +13,3 @@ function OutboundNeighborhoodIndex(graph) { | ||
var NeighborhoodPointerArray = typed.getPointerArray(upperBound); | ||
var NodesPointerArrray = typed.getPointerArray(graph.order); | ||
var NodesPointerArray = typed.getPointerArray(graph.order); | ||
@@ -18,3 +19,3 @@ // NOTE: directedSize + undirectedSize * 2 is an upper bound for | ||
this.graph = graph; | ||
this.neighborhood = new NodesPointerArrray(upperBound); | ||
this.neighborhood = new NodesPointerArray(upperBound); | ||
@@ -90,5 +91,5 @@ this.starts = new NeighborhoodPointerArray(graph.order + 1); | ||
var NeighborhoodPointerArray = typed.getPointerArray(upperBound); | ||
var NodesPointerArrray = typed.getPointerArray(graph.order); | ||
var NodesPointerArray = typed.getPointerArray(graph.order); | ||
weightAttribute = weightAttribute || 'weight'; | ||
var weightGetter = createWeightGetter(weightAttribute); | ||
@@ -98,4 +99,5 @@ // NOTE: directedSize + undirectedSize * 2 is an upper bound for | ||
this.graph = graph; | ||
this.neighborhood = new NodesPointerArrray(upperBound); | ||
this.neighborhood = new NodesPointerArray(upperBound); | ||
this.weights = new Float64Array(upperBound); | ||
this.outDegrees = new Float64Array(graph.order); | ||
@@ -123,9 +125,8 @@ this.starts = new NeighborhoodPointerArray(graph.order + 1); | ||
neighbor = graph.opposite(node, edge); | ||
weight = graph.getEdgeAttribute(edge, weightAttribute); | ||
weight = weightGetter(graph.getEdgeAttributes(edge)); | ||
if (typeof weight !== 'number') weight = 1; | ||
// NOTE: for weighted mixed beware of merging weights if twice the same neighbor | ||
this.neighborhood[n] = ids[neighbor]; | ||
this.weights[n++] = weight; | ||
this.outDegrees[i] += weight; | ||
} | ||
@@ -132,0 +133,0 @@ } |
{ | ||
"name": "graphology-indices", | ||
"version": "0.14.0", | ||
"version": "0.15.0", | ||
"description": "Miscellaneous indices for graphology.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40321
1122