tags:

views:

862

answers:

4

I'm trying to find a simple Java API for creating graph relationships - addEdge(), addNode(), isConnected(node1, node2), findPaths(node1, node2), etc. No UI, just logic. I can find a bunch of academic projects, but none seems to be "The Definitive Graph API".

Does anyone know if such a thing exists?

+6  A: 

JGraphT sounds like what you're after.

JGraphT is a free Java graph library that provides mathematical graph-theory objects and algorithms. JGraphT supports various types of graphs.

Their API can create graphs from various input and also supports creating graphs using addVertex, addEdge. They support finding shortest paths using various well know algorithms such as Bellman-Ford and Dijkstra They also have a complete javadoc available online.

Ben S
how can one create minimum spanning trees with JGraphT?
Rosarch
What about prefuse?
zengr
A: 

a really decent one can be found here: http://javaddlib.sourceforge.net/jdd/

MahdeTo
A: 

Yet another.

erickson
+2  A: 

JDLS is a great library for Graphs and Datastructures in general. You could also use the Grappa library. Its advantage is that it can use the graphViz libraries for graph layouting.

lewap