JGAlgo

What is the JGAlgo Library?

The Java Graph Algorithm library is a high-performance library for graph algorithms written in Java. It contains a wide collection of optimized algorithms and data structures for a range of problems on graphs. From calculating shortest paths and maximum flows to computing minimum spanning trees, maximum matchings, vertex covers, and minimum coloring.

The library runs on Java 11 or higher, and it is installed using Maven.

Quick Start

Add jgalgo-core as a dependency to your project pom.xml:

<dependency>

<groupId>com.jgalgo</groupId>

<artifactId>jgalgo-core</artifactId>

<version>0.4.0</version>

</dependency>

Algorithms

JGAlgo library offers a diverse collection of graph algorithms that operate on a Graph object as input. From finding the shortest paths and maximum flows to computing minimum spanning trees, vertex covers, and cycle detection, the library provides a comprehensive set of optimized algorithms solving these problems.

Shortest Path

The Shortest Path family of algorithms deals with finding the shortest paths between vertices in a graph, where 'shortest' is defined with respect to a weight function that assign a real value to each edge, and the 'length' (or 'weight') of a path is its edge weights sum.


Matching

Matching is a set of edges without common vertices.

Flow

Flow network is mapping of each directed edge in a graph to capacity and flow amount values. The amount of flow on an edge cannot exceed the capacity of the edge. An amount of flows along edges entering a vertex should be equal to the amount of flows along edges exiting it, except special vertices such as source and sink.

Algorithms of flow problem solve questions such as 'what is maximum flow that can be passed through the network from a source(s) to a sink(s)?'.

Minimum Spanning Tree (MST)

The Minimum Spanning Tree algorithms find the spanning tree (edges subset that maintain the connectivity of the graph) with the minimum weight with respect to a given edge weight function. Both  undirected and directed graphs are supported.
[javadoc]

Cores

Given a graph G=(V,E), a subgraph H induced by a subset of vertices W is a k-core if it is the maximum subgraph in which every vertex has a degree of at least k. The core number of vertex is the highest order of a core that contains this vertex. A cores algorithm can compute the core of a specific k, or the core number of the vertices.
[javadoc]

Cliques

Finds all maximal cliques in an undirected graph using algorithms like the Bron-Kerbosch algorithm. A clique is a set of vertices where every pair of vertices is adjacent, and a maximal clique is a clique that cannot be extended by adding more vertices.
[javadoc]

Coloring

The Coloring family of algorithms is concerned with finding the minimum number of colors needed to color the vertices of an undirected graph such that no adjacent vertices share the same color.
[javadoc]

Graph Traversal

Traversal algorithms are used to explore the vertices and edges of a graph in a systematic way.

Connectivity and Cuts

The connectivity of a graph is the ability of reaching from one vertex to another use the (maybe directed) edges of the graph.

Covers

Cycles

Cycles algorithms involves finding cycles in a graph.

Lowest Common Ancestor (LCA)

Given a tree, the least common ancestor of two vertices is the common ancestor of both vertices (contained in the paths from the vertices to the root) and is the furthest from the root (lowest).

Isomorphism

Given two graphs, an isomorphic mapping is a mapping between the vertices of the two graphs while preserving the structure of the graph. There are a few variants of the problem:

All The variants are supported by the library using algorithms like the VF2 algorithm.
[javadoc]

Other

Graphs I/O

The library supports reading and writing graphs from/to files in various formats. The supported formats are:

 License

The JGAlgo library is released under Apache License, Version 2.0.