Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

very large networks ( > 1M nodes) possible? #79

Open
paul-shannon opened this issue May 14, 2016 · 6 comments
Open

very large networks ( > 1M nodes) possible? #79

paul-shannon opened this issue May 14, 2016 · 6 comments

Comments

@paul-shannon
Copy link

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

Thanks!

  • Paul
@frewsxcv
Copy link
Owner

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. very large networks ( > 1M nodes) possible? #79

@paul-shannon
Copy link
Author

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

  • Paul

@frewsxcv
Copy link
Owner

<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>

@paul-shannon
Copy link
Author

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

@frewsxcv
Copy link
Owner

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'.

@paul-shannon
Copy link
Author

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

  • Paul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants