Binary graph operators:
It is now possible to require individual modules and still get the benefits of async code execution through workers.
Example:
var completeGraph = require('jsnetworkx/node/generators/classic').completeGraph;
var cluster = require('jsnetworkx/node/algorithms/cluster');
var WorkerSettings = require('jsnetworkx/node/WorkerSettings');
var initializeBrowserWorker = require('jsnetworkx/node/initializeBrowserWorker');
global.genClustering = cluster.genClustering;
global.completeGraph = completeGraph;
WorkerSettings.methodLookupFunction = function(name) {
return cluster[name];
};
initializeBrowserWorker();
This is a custom module which only exposes completeGraph
and genClustering
.
WorkerSettings.methodLookupFunction
This function is used by the worker (and delegateToSync
!) to resolve
the method name the worker receives, to the actual function. E.g. the
prebuilt version of JSNetworkX uses name => jsnx[name]
.
initializeBrowserWorker
This function tests whether we are in a worker environment and if yes, sets up the event handlers and takes care of (de)serializing the data. This function should be called in the worker script.
Given the example above, the custom bundle could be created with
JSNETWORKX_BUNDLE='bundle.js' browserify test.js > bundle.js
Weighted and generic shortest path algorithms. The "generic" functions provide a single interface for weighted and unweighted algorithms.
including async (gen*) versions.
clustering
is available as genClustering
. Those methods return a Promise
and will
delegate to a web worker in browsers. In Node.js, a new process will be
spawned.stickyDrag
. If set to true
, the dragged node will keep
its new position after dragging and is not subject to the force layout.
D3 example.underscore_method_names
to camelCaseMethodNames
.{type, name, n, list}
as first argument instead of an array [type, name, n, list]
.{n1: ..., n2: ..., ...}
and n1
, n2
, ... would have been treated as nodes.
Instead, any object that implements the ES6 iterator protocol
can be used.
This includes (by default) arrays and generator functions.new
anymore. I.e. you have to use
var G = new jsnx.Graph();
instead of var G = jsnx.Graph();
. That's because
ES6 classes cannot be called without new
.cumulative_sum
, generate_unique_node
and
is_list_of_ints
have been removed, since there was no need for them.balancedTree
doesn't set the height to 2
anymore if the branching factor is
1
. So balancedTree(1, 4)
is equivalent to pathGraph(4)
.camelCase
now instead of
under_score
.此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。