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!

peteorpeter
  • 4,037
  • 2
  • 29
  • 47

5 Answers5

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

Anvaka
  • 15,658
  • 2
  • 47
  • 56
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.

J Trana
  • 2,150
  • 2
  • 20
  • 32
  • 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 (http://www.hoopoe-cloud.com/?) for layouts. Quote: "drawing graphs with hundreds of thousands of vertices within a few seconds" sounds pretty promising... – peteorpeter Apr 07 '11 at 14:07
  • Not sure how you missed out on the Rep... I think yours is the best answer, however. Sorry :( – peteorpeter Apr 19 '11 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

Seb
  • 618
  • 5
  • 11
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.

Sebastian
  • 7,729
  • 2
  • 37
  • 69
0

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.

Mahdi Yusuf
  • 19,931
  • 26
  • 72
  • 101
  • 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! – peteorpeter Apr 06 '11 at 16:57
  • If your looking for lay out algorithms specifically you can look into http://www.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. – Mahdi Yusuf Apr 06 '11 at 17:20
  • I'll add zest to the candidate list - any idea of it's speed? – peteorpeter Apr 07 '11 at 14:00
  • its pretty quick, even on larger models! – Mahdi Yusuf Apr 07 '11 at 20:43