frewsxcv/graphosaurus

very large networks ( > 1M nodes) possible?

Opened this issue · 6 comments

Intrigued to discover this project. Before diving in, may I ask if Graphosaurus supports very large networks, with > 10^6 nodes?

Thanks!

  • Paul

Just tried this out. It looks like 1M nodes + 1M edges results in just
under 1 FPS for me. 100K nodes + 100K edges gets something more like 20
FPS for me. I unfortunately have spent little time on optimizations for
Graphosaurus, so there's probably tons of room for improvement. Let me
know if you have any other questions!

On Fri, May 13, 2016, at 08:37 PM, Paul Shannon wrote:

Intrigued to discover this project. Before diving in, may I ask if
Graphosaurus supports very large networks, with > 10^6 nodes?
Thanks!

  • Paul

    You are receiving this because you are subscribed to this thread.
    Reply to this email directly or view it on GitHub[1]

Links:

  1. #79

Thanks, Corey. Could I trouble you to post your code, perhaps as a gist?

  • Paul
<html>
<head>
  <meta charset="UTF-8">
  <style>
    #frame {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 0;
    }
  </style>
</head>
<body>

<div id="frame"></div>

<script src="../../dist/graphosaurus.js"></script>
<script>
var nodes = [];

graph = G.graph({
  nodeImage: "../_common/disc.png",
  nodeImageTransparent: true,
  antialias: true,
  bgColor: 0xEEEEEE,
  edgeWidth: 4,
  nodeSize: 18,
});


for (var i = 0; i < 100000; i++) {
  var node = G.node(randomPosition(), {color: 0x444444});
  if (nodes.length > 0) {
    var randomIndex = Math.floor(Math.random() * nodes.length);
    var otherNode = nodes[randomIndex];
    G.edge([node, otherNode], {color: 0x222222}).addTo(graph);
  }
  nodes.push(node);
  node.addTo(graph);
}

graph.renderIn('frame');

function randomPosition() {
  return [Math.random(), Math.random(), Math.random()];
}
</script>
</body>
</html>

Very nice., thank you. This is some lovely capability you have created.

After running a few examples I am now experimenting with trees, with the goal of rendering phylogenetic relationships in the microbiome. Two questions arose quickly for me:

  1. How do I gain access to three.js scene, camera etc. through the nice abstractions you provide?
  2. How to render nodes so that their size scales with the zoom applied to the canvas? At present (see two images pasted in) the nodes keep their absolute screen size at all zoom levels.

image

image

Wow, I must have missed this last comment. Sorry for the very late reply!

  1. How do I gain access to three.js scene, camera etc. through the nice abstractions you provide?
var frame = graph.renderIn("#some-id");
console.log(frame.scene);
console.log(frame.camera);
console.log(frame.renderer);

More info in frame.js.

  1. How to render nodes so that their size scales with the zoom applied to the canvas?

I think you want Graph({sizeAttenuation: true})

* @param {Boolean} props.sizeAttenuation - 'true' if nodes' size should change with distance. Defaults to 'false'.

Thanks, Cory! Your answers are very encouraging -- if a little delayed :} I will get back to my experimenting soon.

  • Paul