MCPcopy Index your code
hub / github.com/clips/pattern / normalize

Function normalize

pattern/graph/graph.js:1438–1443  ·  view source on GitHub ↗
(vector)

Source from the content-addressed store, hash-verified

1436 if (a.iterations === undefined) a.iterations = 100;
1437 if (a.tolerance === undefined) a.tolerance = 0.0001;
1438 function normalize(vector) {
1439 var w = 1.0 / (Array.sum(Object.values(vector)) || 1);
1440 for (var node in vector) {
1441 vector[node] *= w;
1442 }
1443 }
1444 var G = Graph.adjacency(graph, a);
1445 var v = {}; for(var n in graph.nodeset) v[n] = Math.random(); normalize(v);
1446 // Eigenvector calculation using the power iteration method: y = Ax.

Callers 2

graph.jsFile · 0.70
cooccurrenceFunction · 0.50

Calls 1

valuesMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…