17

We currently have a dynamically updated network graph with around 1,500 nodes and 2,000 edges. It's ever-growing. Our current layout engine uses Prefuse - the force directed layout in particular - and it takes about 10 minutes with a hefty server to get a nice, stable layout.

I've looked a little GraphViz's sfpd algorithm, but haven't tested it yet...

Are there faster alternatives I should look at?

  • I don't care about the visual appearance of the nodes and edges - we process that separately - just putting x, y on the nodes.
  • We do need to be able to tinker with the layout properties for specific parts of the graph, for instance, applying special tighter or looser springs for certain nodes.

Thanks in advance, and please comment if you need more specific information to answer!

EDIT: I'm particularly looking for speed comparisons between the layout engine options. Benchmarks, specific examples, or just personal experience would suffice!

5 Answers 5

16

I wrote a JavaScript-based graph drawing library VivaGraph.js.

It calculates layout and renders graph with 2K+ vertices, 8.5K edges in ~10-15 seconds. If you don't need rendering part it should be even faster.

Here is a video demonstrating it in action: WebGL Graph Rendering With VivaGraphJS.

Online demo is available here. WebGL is required to view the demo but is not needed to calculate graphs layouts. The library also works under node.js, thus could be used as a service.

Example of API usage (layout only):

var graph = Viva.Graph.graph(),
    layout = Viva.Graph.Layout.forceDirected(graph);

graph.addLink(1, 2);
layout.run(50); // runs 50 iterations of graph layout

// print results:
graph.forEachNode(function(node) { console.log(node.position); })

Hope this helps :)

2
  • 1
    Impressive. That it's JS and easily moved between client/server is powerful - that was a big allure with the original Prefuse java library. Oct 5, 2012 at 16:29
  • Wow the library renders a graph a lot quicker than others I have tested. Thanks Mar 1, 2015 at 19:05
6

I would have a look at OGDF, specifically http://www.ogdf.net/doku.php/tech:howto:frcl I have not used OGDF, but I do know that Fast Multipole Multilevel is a good performant algorithm and when you're dealing with the types of runtimes involved with force directed layout with the number of nodes you want, that matters a lot. Why, among other reasons, that algorithm is awesome: Fast Multipole method. The fast multipole method is a matrix multiplication approximation which reduces the O() runtime of matrix multiplication for approximation to a small degree. Ideally, you'd have code from something like this: http://mgarland.org/files/papers/layoutgpu.pdf but I can't find it anywhere; maybe a CUDA solution isn't up your alley anyways.

Good luck.

2
  • OGDF and the description of the FM3 algorithm look really promising! I don't think CUDA's on the table (our infrastructure is all 3rd-party hosted and crazy secure) but you never know - maybe we can ship off our graphML to a GPU cloud provider (hoopoe-cloud.com/?) for layouts. Quote: "drawing graphs with hundreds of thousands of vertices within a few seconds" sounds pretty promising... Apr 7, 2011 at 14:07
  • Not sure how you missed out on the Rep... I think yours is the best answer, however. Sorry :( Apr 19, 2011 at 19:26
6

The Gephi Toolkit might be what you need: some layouts are very fast yet with a good quality: http://gephi.org/toolkit/

30 secondes to 2 minutes are enough to layout such a graph, depending on your machine. You can use the ForAtlas layout, or the Yifan Hu Multilevel layout.

For very large graphs (+50K nodes and 500K links), the OpenOrd layout wil

1
3

In a commercial scenario, you might also want to look at the family of yFiles graph layout and visualization libraries.

Even the JavaScript version of it can perform layouts for thousands of nodes and edges using different arrangement styles. The "organic" layout style is an implementation of a force directed layout algorithm similar in nature to the one used in Neo4j's browser application. But there are a lot more layout algorithms available that can give better visualizations for certain types of graph structures and diagrams. Depending on the settings and structure of the problem, some of the algorithms take only seconds, while more complex implementations can also bring your JavaScript engine to its knees. The Java and .net based variants still perform quite a bit better, as of today, but the JavaScript engines are catching up.

You can play with these algorithms and settings in this online demo.

Disclaimer: I work for yWorks, which is the maker of these libraries, but I do not represent my employer on SO.

0
+50

I would take a look at http://neo4j.org/ its open source which is beneficial in your case so you can customize it to your needs. The github account can be found here.

4
  • Doesn't address the graph layout (which I'm afraid is the main thrust of the question), but interesting from a data management perspective. We do have a need to traverse around, process, and investigate the graph structure on the backend. Thanks for the link! Apr 6, 2011 at 16:57
  • If your looking for lay out algorithms specifically you can look into eclipse.org/gef/zest that might be more what your interested in. :) I know for a fact that it can handle up to 10,000 nodes/relationships on a simple desktop computer. Apr 6, 2011 at 17:20
  • I'll add zest to the candidate list - any idea of it's speed? Apr 7, 2011 at 14:00
  • its pretty quick, even on larger models! Apr 7, 2011 at 20:43

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.