TOOL
JGraphT logo

JGraphT

JGraphT (Java graph library)

JGraphT is a free, open-source Java library of graph-theory data structures and algorithms. It was started by Barak Naveh in the early 2000s and is today maintained by a community of contributors, with Dimitrios Michail, Joris Kinable, and John V. Sichi among the principal authors; development happens on GitHub and the project is dual-licensed under the LGPL 2.1 and the EPL 2.0, allowing users to choose either. Rather than a file format or a desktop application, it is a programming toolkit meant to be embedded in JVM applications that need to represent and compute over graphs.

Its data model is built around generics: any Java object can serve as a vertex or an edge, giving compile-time type safety while keeping the graph structure independent of the domain objects. The library covers the full matrix of graph kinds, including directed and undirected, weighted and unweighted, simple graphs, multigraphs, and pseudographs, and it adds wrapper and view types such as unmodifiable graphs, listenable graphs that emit change events, live subgraph views, and adapters that bridge to Google Guava's graph types and to the JGraphX visualization library. On top of these structures sits a large algorithm collection: traversal iterators (BFS, DFS, and others), shortest paths, minimum spanning trees, maximum flow, matching, clique enumeration, graph coloring, connectivity, cycle detection, isomorphism, and centrality measures, making it one of the most algorithmically complete graph libraries on the JVM.

For interoperability JGraphT ships importers and exporters in its org.jgrapht.nio module for many external representations, so it can round-trip graphs to and from GraphML (with both a fast lightweight parser and a spec-complete one), DOT, GML, GEXF, CSV, DIMACS, the compact Graph6 and sparse6 encodings, JSON, and matrix formats. This makes it a practical conversion hub inside JVM pipelines and a natural companion to visualization and analysis tools such as Gephi, Cytoscape, and the DOT-based Graphviz, or to other library-level engines like NetworkX, igraph, and graph-tool.

Its main strengths are breadth of algorithms, a clean generic API, performance, and stability; a sparse-graph representation is available for large, mostly static graphs. The chief limitations are that it is JVM-bound (though official Python bindings backed by a GraalVM-compiled native build exist), it is an in-memory library rather than a persistent graph database, and its rich object-per-vertex model can be memory-heavy for very large graphs unless the specialized sparse structures are used.

Graph Formats(Input & Output)

Frequently Asked Questions

What graph file formats does JGraphT support?

See the list on this page — it shows every format JGraphT can read, write and display.

How do I import a graph into JGraphT?

Convert your file to a format JGraphT can read, then open it in JGraphT. Use GraphInOut to get a JGraphT-compatible file in seconds.

How do I convert a file so JGraphT can open it?

Use the convert links above — upload or paste your graph, pick a format JGraphT accepts and download the result, right in your browser.