Reputation: 948
I have a JavaScript array where I store states of a network (for my application, each state is a different vis.js network). My problem is, when I draw each state, it is drawn randomly. So, I would like to know if it's possible stablish a seed or something that allows draw a network in deterministic way (I want always starts drawing the same thing with the same shape).
The goal is drawing each state seems a new node and some edges has been added, without it seems network has moved.
Is there any way to get it?
Thanks!
Upvotes: 3
Views: 2342
Reputation: 368
Hey this might help but you do have the ability in the options to stipulate a randomSeed that does a deterministic drawing of your graph, other options also exist that allow a hierarchical layout and directions.
Please see the following list for all options and explanations: http://visjs.org/docs/network/layout.html.
var options = {
layout: {
randomSeed: 1,
improvedLayout: true,
hierarchical: {
direction: 'LR', // UD, DU, LR, RL
sortMethod: 'directed' // hubsize, directed
}
}
}
Upvotes: 7