JGraphT is a free Java class library that provides mathematical graph-theory objects and algorithms.

See: Description

Packages 
Package Description
org.jgrapht
The front-end API's interfaces and classes, including Graph, DirectedGraph and UndirectedGraph.
org.jgrapht.alg
Algorithms provided with JGraphT.
org.jgrapht.alg.util
Utilities used by JGraphT algorithms.
org.jgrapht.event
Event classes and listener interfaces, used to provide a change notification mechanism on graph modification events.
org.jgrapht.ext
Extensions and integration means to other products.
org.jgrapht.generate
Generators for graphs of various topologies.
org.jgrapht.graph
Implementations of various graphs.
org.jgrapht.traverse
Graph traversal means.
org.jgrapht.util
Non-graph-specific data structures, algorithms, and utilities used by JGraphT.