views:

9600

answers:

14

Has anyone had good experiences with any Java libraries for Graph algorithms. I've tried JGraph and found it ok, and there are a lot of different ones in google. Are there any that people are actually using successfully in production code or would recommend?

To clarify, I'm not looking for a library that produces graphs/charts, I'm looking for one that helps with Graph algorithms, eg minimum spanning tree, Kruskal's algorithm Nodes, Edges, etc. Ideally one with some good algorithms/data structures in a nice Java OO API.

+1  A: 

For visualization our group had some success with prefuse. We extended it to handle architectural floorplates and bubble diagraming, and it didn't complain too much. They have a new Flex toolkit out too called Flare that uses a very similar API.

UPDATE: I'd have to agree with the comment, we ended up writing a lot of custom functionality/working around prefuse limitations. I can't say that starting from scratch would have been better though as we were able to demonstrate progress from day 1 by using prefuse. On the other hand if we were doing a second implementation of the same stuff, I might skip prefuse since we'd understand the requirements a lot better.

Jacob Rigby
What were your personal thoughts with prefuse? At my last job, a project started to use it, but ended up with a 90%+ rewritten (and optimized, with additions of new features) version of prefuse.
Thomas Owens
+2  A: 

In a university project I toyed around with yFiles by yWorks and found it had pretty good API.

Turismo
I've used yFiles for visualisation of interdependencies between data items (as part of a commercial software platform). I didn't really use any graph analysis algorithms, but check if the y.algo package has what you need:http://www.yworks.com/products/yfiles/doc/api/
Jonik
A: 

If you are actually looking for Charting libraries and not for Node/Edge Graph libraries I would suggest splurging on Big Faceless Graph library (BFG). It's way easier to use than JFreeChart, looks nicer, runs faster, has more output options, really no comparison.

Jacob Rigby
+5  A: 

JUNG is a good option for visualisation, and also has a fairly good set of available graph algorithms, including several different mechanisms for random graph creation, rewiring, etc. I've also found it to be generally fairly easy to extend and adapt where necessary.

Kai
+1  A: 

I don't know if I'd call it production-ready, but there's jGABL.

Hank Gay
+4  A: 

Check out JGraphT for a very simple and powerful Java graph library that is pretty well done and, to allay any confusion, is different than JGraph. Some sample code:

UndirectedGraph<String, DefaultEdge> g =
        new SimpleGraph<String, DefaultEdge>(DefaultEdge.class);

    String v1 = "v1";
    String v2 = "v2";
    String v3 = "v3";
    String v4 = "v4";

    // add the vertices
    g.addVertex(v1);
    g.addVertex(v2);
    g.addVertex(v3);
    g.addVertex(v4);

    // add edges to create a circuit
    g.addEdge(v1, v2);
    g.addEdge(v2, v3);
    g.addEdge(v3, v4);
    g.addEdge(v4, v1);
Joe Liversedge
+11  A: 

If you were using JGraph, you should give a try to JGraphT which is designed for algorithms. One of its features is visualization using the JGraph library. It's still developed, but pretty stable. I analyzed the complexity of JGrapT algorithms some time ago. Some of them aren't the quickest, but if you're going to implement them on your own and need to display your graph, then it might be the best choice. I really liked using its api, when I quickly had to write an app that was working on graph and displaying it later.

bibix
+2  A: 

JDSL (Data Structures Library in Java) should be good enough if you're into graph algorithms - http://www.jdsl.org

mr.sverrir
Thanks for this, I'd never come across it. Are you using it?
Nick Fortescue
Yes, I am using it. I started using it maybe 4 years ago. So far so good, I just wish there was a port of that for .NET, too.
mr.sverrir
+1  A: 

I collected a couple of links in my blog: http://blog.pdark.de/2009/02/11/graph-layout-in-java/

Aaron Digulla
+4  A: 

Summary:

  • JGraphT if you are more interested in data structures and algorithms.
  • JGraph if your primary focus is visualization.
  • Jung, yworks and BFG are other things people tried using.
  • Perfuse is a no no since one has to rewrite most of it.
mansu
A: 

Hi, Try Annas its an open source graph package which is easy to get to grips with

http://annas.googlecode.com

+1  A: 

http://neo4j.org/ is a graph database that contains many of graph algorithms and scales better than most in-memory libraries.

Jonathan Hendler
A: 

http://incubator.apache.org/hama/ is a distributed scientific package on Hadoop for massive matrix and graph data.

xyz
A: 

JGraph from http://mmengineer.blogspot.com/2009/10/java-graph-floyd-class.html

Provides a powerfull software to work with graphs (direct or undirect). Also generates Graphivz code, you can see graphics representations. You can put your own code algorithms into pakage, for example: backtracking code. The package provide some algorithms: Dijkstra, backtracking minimun path cost, ect..

Bob