We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2f1fbf4 commit 4cfa338Copy full SHA for 4cfa338
1 file changed
index.js
@@ -311,7 +311,8 @@ module.exports = function Graph(serialized){
311
adjacent(source).forEach(function (target){
312
serialized.links.push({
313
source: source,
314
- target: target
+ target: target,
315
+ weight: getEdgeWeight(source, target)
316
});
317
318
@@ -322,7 +323,7 @@ module.exports = function Graph(serialized){
322
323
// Deserializes the given serialized graph.
324
function deserialize(serialized){
325
serialized.nodes.forEach(function (node){ addNode(node.id); });
- serialized.links.forEach(function (link){ addEdge(link.source, link.target); });
326
+ serialized.links.forEach(function (link){ addEdge(link.source, link.target, link.weight); });
327
return graph;
328
}
329
0 commit comments