JGraphT - Core

A Java class library for graph-theory data structures and algorithms.





JGraphT General Purpose Libraries




Last Version

Last Version

Release Date

Release Date





JGraphT - Core
A Java class library for graph-theory data structures and algorithms.

Download jgrapht-core

How to add to project

<!-- https://jarcasting.com/artifacts/com.io7m.jgrapht/jgrapht-core/ -->
// https://jarcasting.com/artifacts/com.io7m.jgrapht/jgrapht-core/
implementation 'com.io7m.jgrapht:jgrapht-core:1.2.1-MODULARIZED'
// https://jarcasting.com/artifacts/com.io7m.jgrapht/jgrapht-core/
implementation ("com.io7m.jgrapht:jgrapht-core:1.2.1-MODULARIZED")
<dependency org="com.io7m.jgrapht" name="jgrapht-core" rev="1.2.1-MODULARIZED">
  <artifact name="jgrapht-core" type="jar" />
@Grab(group='com.io7m.jgrapht', module='jgrapht-core', version='1.2.1-MODULARIZED')
libraryDependencies += "com.io7m.jgrapht" % "jgrapht-core" % "1.2.1-MODULARIZED"
[com.io7m.jgrapht/jgrapht-core "1.2.1-MODULARIZED"]


test (4)

Group / Artifact Type Version
junit : junit jar 4.12
com.googlecode.junit-toolbox : junit-toolbox jar 2.4
org.openjdk.jmh : jmh-core jar 1.19
org.openjdk.jmh : jmh-generator-annprocess jar 1.19

Project Modules

There are no modules declared in this project.

Build Status Maven Central Snapshot License License Language


Released: June 14, 2020

Written by Barak Naveh and Contributors

(C) Copyright 2003-2020, by Barak Naveh and Contributors. All rights reserved.

Please address all contributions, suggestions, and inquiries to the user mailing list


JGraphT is a free Java class library that provides mathematical graph-theory objects and algorithms. It runs on Java 2 Platform (requires JDK 11 or later starting with JGraphT 1.5.0).

JGraphT may be used under the terms of either the

or the

As a recipient of JGraphT, you may choose which license to receive the code under.

For detailed information on the dual license approach, see https://github.com/jgrapht/jgrapht/wiki/Relicensing.

A copy of the EPL license and the LPGL license is included in the download.

Please note that JGraphT is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Please refer to the license for details.

SPDX-License-Identifier: LGPL-2.1-or-later OR EPL-2.0

Release Contents

The files below make up the table of contents for a release distribution archive (produced by mvn package):

  • README.md this file
  • CONTRIBUTORS.md list of contributors
  • HISTORY.md changelog
  • license-EPL.txt Eclipse Public License 2.0
  • license-LGPL.txt GNU Lesser General Public License 2.1
  • javadoc/ Javadoc documentation
  • lib/ JGraphT libraries and dependencies:
    • jgrapht-core-x.y.z.jar core library
    • jgrapht-demo-x.y.z.jar demo classes
    • jgrapht-ext-x.y.z.jar extensions
    • jgrapht-io-x.y.z.jar Importers/Exporters for various graph formats
    • jgrapht-guava-x.y.z.jar Adapter classes for the Guava library
    • jgraphx-a.b.c.jar JGraphX dependency library
    • antlr4-runtime-x.y.jar ANTLR parser runtime
    • commons-lang3-x.y.z.jar Apache Commons Lang library
    • commons-text-x.y.jar Apache Commons Text library
    • fastutil-x.y.z.jar Fastutil library
    • guava-x.y-jre.jar Guava library
    • jheaps-x.y.jar JHeaps library
  • source/ complete source tree used to build this release

Getting Started

The JGraphT wiki provides various helpful pages for new users, including a How to use JGraphT in your projects page. The package org.jgrapht.demo includes small demo applications to help you get started. If you spawn your own demo app and think others can use it, please send it to us and we will add it to that package.

To run the graph visualization demo from the downloaded release, try executing this command in the lib directory:

java -jar jgrapht-demo-x.y.z.jar

More information can be found on the user pages of our wiki. Finally, all classes come with corresponding test classes. These test classes contain many examples.

To help us understand how you use JGraphT, and which features are important to you, tell us how you are using JGraphT, and cite the usage of JGraphT in your book, paper, website, or technical report.

Using via Maven

Starting from 0.9.0, every JGraphT release is published to the Maven Central Repository. You can add a dependency from your project as follows:


We have also started auto-publishing SNAPSHOT builds for every successful commit to master. To use the bleeding edge:


and make sure the snapshot repository is enabled:


Upgrading Versions

To help upgrading, JGraphT maintains a one-version-backwards compatibility. While this compatibility is not a hard promise, it is generally respected. (This policy was not followed for the jump from 0.6.0 to 0.7.0 due to the pervasive changes required for generics.) You can upgrade via:

  • The safe way: compile your app with the JGraphT version that immediately follows your existing version and follow the deprecation notes, if they exist, and modify your application accordingly. Then move to the next version, and on, until you're current.
  • The fast way: go to the latest JGraphT right away - if it works, you're done.

Reading the change history is always recommended.


A local copy of the Javadoc HTML files is included in the distribution. The latest version of these files is also available on-line.


  • JGraphT requires JDK 11 or later to build starting with version 1.5.0.
  • JHeaps is a library with priority queues. JHeaps is licensed under the terms of the Apache License, Version 2.0.
  • JUnit is a unit testing framework. You need JUnit only if you want to run the unit tests. JUnit is licensed under the terms of the IBM Common Public License. The JUnit tests included with JGraphT have been created using JUnit 4.
  • XMLUnit extends JUnit with XML capabilities. You need XMLUnit only if you want to run the unit tests. XMLUnit is licensed under the terms of the BSD License.
  • JGraphX is a graph visualizations and editing component (the successor to the older JGraph library). You need JGraphX only if you want to use the JGraphXAdapter to visualize the JGraphT graph interactively via JGraphX. JGraphX is licensed under the terms of the BSD license.
  • ANTLR is a parser generator. It is used for reading text files containing graph representations, and is only required by the jgrapht-io module. ANTLR v4 is licensed under the terms of the BSD license.
  • Guava is Google's core libraries for Java. You need Guava only if you are already using Guava's graph data-structures and wish to use our adapter classes in order to execute JGraphT's algorithms. Only required by the jgrapht-guava module.
  • Apache Commons Proper is an Apache project containing reusable Java components. The packages commons-text and commons-lang3. which provide additional utilities for String manipulation are only required by the jgrapht-io module.
  • fastutil provides a collection of type-specific maps, sets, lists and queues with a small memory footprint and fast access and insertion. Fastutil is only required by the jgrapht-opt module.

Online Resources

The JGraphT website is at http://www.jgrapht.org. You can use this site to:

  • Obtain the latest version: latest version and all previous versions of JGraphT are available online.
  • Report bugs: if you have any comments, suggestions or bugs you want to report.
  • Get support: if you have questions or need help with JGraphT.

There is also a wiki set up for everyone in the JGraphT community to share information about the project. For support, refer to our support page

Source code is hosted on github. You can send contributions as pull requests there.

Your Improvements

If you add improvements to JGraphT please send them to us as pull requests on github. We will add them to the next release so that everyone can enjoy them. You might also benefit from it: others may fix bugs in your source files or may continue to enhance them.


With regards from

Barak Naveh, JGraphT Project Creator

John Sichi, JGraphT Project Administrator

Joris Kinable, JGraphtT Project Reviewer/Committer and Release Manager

Dimitrios Michail, JGraphT Project Reviewer/Committer