g6/plugins/layout.forceAtlas2
2018-08-14 15:50:11 +08:00
..
body.js fix:variable names, deleting unnecessary files 2018-08-06 11:56:17 +08:00
forceCalculator.js test: force atlas2 test 2018-08-14 15:50:11 +08:00
index.js feat: forceAtlas2 && fisheye 2018-07-10 11:08:57 +08:00
layout.js test: force atlas2 test 2018-08-14 15:50:11 +08:00
layout.worker.js test: force atlas2 test 2018-08-14 15:50:11 +08:00
quad.js fix:variable names, deleting unnecessary files 2018-08-06 11:56:17 +08:00
quadTree.js webworker pach problem 2018-07-22 17:55:52 +08:00
README.md fix:variable names, deleting unnecessary files 2018-08-06 11:56:17 +08:00

forceAtlas2

ForceAtlas2(https://medialab.sciencespo.fr/publications/Jacomy_Heymann_Venturini-Force_Atlas2.pdf) is a graph layout algorithm, whose parameters determine the result.

  • kr: repulsive parameter, larger the kr, more loose the layout.
  • kg: gravity parameter, larger the kg, more central the layout.
  • mode: 'normal'/'linlog' 'normal': normal layout 'linlog': the cluster will be more compact
  • preOverlapping: true/false. true: prevents node overlapping, result in non-node-overlapping layout false: allows node overlapping.
  • dissuadeHubs: true/false. whether active the dissuade hub mode true: grant authorities(nodes with a high indegree) a more central position than hubs(nodes with a high outdegree) false: without dissuade hub mode
  • barnesHut: true/false. Whether active the barnes hut optimization on computing repulsive foces. We implemented the paper 'A hierarchical O(N log N) force-calculation algorithm strategy'(https://www.nature.com/articles/324446a0).
  • ks: controls the global velocity. Default: 0.1
  • ksmax: the max global velocity. Default: 10
  • tao: the tolerance for the global swinging. Default: 0.1
  • maxIteration: the iteration to terminate the algorithm. We suggest 700 for the graph with less than 50 nodes; 1000 for 100 nodes; Upper than 1500 for more nodes.

use

simple use.

$.getJSON('../../test/fixtures/viralMarketing.json', data => {
  const Plugin = G6.Plugins['layout.forceAtlas2'];
  const layoutParams = {
    maxIteration: 1500,
    prevOverlapping: true,
    kr: 15,
    mode: 'normal',
    barnesHut: false, // may be counter-productive on small networks
    ks: 0.1,
    dissuadeHubs: false
  };
  graph = new G6.Graph({
    id: 'mountNode', // dom id
    plugins: [new Plugin(layoutParams)],
    height: 1000,
  });
  graph.read(data);
});