Package com.jgalgo.alg
Most algorithms accept a Graph
object as input, and perform some computation on it.
Algorithms in this package follow a common pattern: an interface is defined for the functionality only (e.g.
ShortestPathSingleSource
), a result object is defined within the interface (e.g.
ShortestPathSingleSource.Result
), a default implementation is provided via
newInstance()
method (e.g. ShortestPathSingleSource.newInstance()
), and a builder that
allow more control over the algorithm is provided via newBuilder()
method (e.g.
ShortestPathSingleSource.newBuilder()
). In addition, algorithm interfaces define a result
specifically for graphs in which the vertices and edges are integer only, IntGraph
(e.g.
ShortestPathSingleSource.IResult
). For the most common use case, there is no need to use
IntGraph
and the result objects that are specific to it.
Non of the algorithms or result objects in this package are thread safe. Result objects should not be used once the graph on which the result was computed is modified, as the result object may relay on the graph for information and may not be able to detect the modification.
Most algorithm implementations are not expose as public API.
-
Interface Summary Interface Description AlgorithmBuilderBase A base interface for all algorithm builders.Bfs Bread first search (BFS) iterator.Bfs.IntIter A BFS iterator forIntGraph
.Bfs.Iter<V,E> A BFS iterator.BiConnectedComponentsAlgo An algorithm that compute the bi-connected components of a graph.BiConnectedComponentsAlgo.Builder A builder forBiConnectedComponentsAlgo
objects.BiConnectedComponentsAlgo.IResult A result object of aBiConnectedComponentsAlgo
computation forIntGraph
.BiConnectedComponentsAlgo.Result<V,E> A result object of aBiConnectedComponentsAlgo
computation.ChinesePostman An algorithm for the chinese postman problem.ChinesePostman.Builder A builder forChinesePostman
objects.ClosuresEnumerator An algorithm that enumerate all the closure subsets in a directed graph.ClosuresEnumerator.Builder A builder forClosuresEnumerator
objects.ColoringAlgo An algorithm that assign a color to each vertex in a graph while avoiding identical color for any pair of adjacent vertices.ColoringAlgo.Builder A builder forColoringAlgo
objects.CoresAlgo Cores computing algorithm.CoresAlgo.Builder A builder forCoresAlgo
objects.CoresAlgo.IResult The result of the cores computation forIntGraph
.CoresAlgo.Result<V,E> The result of the cores computation.CyclesEnumerator An algorithm that enumerate all cycles in a graph.CyclesEnumerator.Builder A builder forCyclesEnumerator
objects.Dfs Depth first search (DFS) iterator.Dfs.IntIter A DFS iterator forIntGraph
.Dfs.Iter<V,E> A DFS iterator.DominatingSetAlgo An algorithm for computing a minimum dominating set.DominatingSetAlgo.Builder A builder forDominatingSetAlgo
algorithms.EdgeCover Minimum edge vertex cover algorithm.EdgeCover.Builder A builder forEdgeCover
algorithms.EulerianTourAlgo Eulerian tour calculation algorithm.EulerianTourAlgo.Builder A builder forEulerianTourAlgo
objects.Flow<V,E> Flow on graph edges.IFlow Flow onIntGraph
edges.IMatching A matching in aIntGraph
.IPath A path of edges in an int graph.IVertexBiPartition A partition of the vertices of an int graph into two blocks.IVertexPartition A partition of the vertices of an int graph.KEdgeConnectedComponentsAlgo An algorithm that compute the k-edge connected components of a graph.KEdgeConnectedComponentsAlgo.Builder A builder forKEdgeConnectedComponentsAlgo
objects.KShortestPathsST An algorithm for computing the K shortest paths between two vertices in a graph.KShortestPathsST.Builder A builder forKShortestPathsST
objects.KVertexConnectedComponentsAlgo Finds the k-vertex connected components of a graph.KVertexConnectedComponentsAlgo.Builder A builder forKVertexConnectedComponentsAlgo
objects.KVertexConnectedComponentsAlgo.IResult Result of aKVertexConnectedComponentsAlgo
computation forIntGraph
.KVertexConnectedComponentsAlgo.Result<V,E> Result of aKVertexConnectedComponentsAlgo
computation.LowestCommonAncestorDynamic Dynamic algorithm for Lowest Common Ancestor (LCA) queries.LowestCommonAncestorDynamic.Builder A builder forLowestCommonAncestorDynamic
objects.LowestCommonAncestorDynamic.Vertex A tree vertex in anLowestCommonAncestorDynamic
data structure.LowestCommonAncestorOffline An algorithm for computing the lowest common ancestor (LCA) of two vertices in a tree, offline.LowestCommonAncestorOffline.Builder A builder forLowestCommonAncestorOffline
objects.LowestCommonAncestorOffline.IQueries Queries container forLowestCommonAncestorOffline
computations forIntGraph
.LowestCommonAncestorOffline.IResult Result of aLowestCommonAncestorOffline
computation forIntGraph
.LowestCommonAncestorOffline.Queries<V,E> Queries container forLowestCommonAncestorOffline
computations.LowestCommonAncestorOffline.Result<V,E> Result of aLowestCommonAncestorOffline
computation.LowestCommonAncestorStatic Static Lowest Common Ancestor (LCA) algorithm.LowestCommonAncestorStatic.Builder A builder forLowestCommonAncestorStatic
objects.LowestCommonAncestorStatic.DataStructure<V,E> Data structure result created from a static LCA pre-processing.LowestCommonAncestorStatic.IDataStructure Data structure result created from a static LCA pre-processing forIntGraph
.Matching<V,E> A matching in a graph.MatchingAlgo Maximum/minimum matching algorithm.MatchingAlgo.Builder A builder forMatchingAlgo
objects.MaximalCliquesEnumerator Algorithm for enumerating over all maximal cliques in a graph.MaximalCliquesEnumerator.Builder A builder forMaximalCliquesEnumerator
objects.MaximumFlow Calculate the maximum flow in a flow network.MaximumFlow.Builder A builder forMaximumFlow
objects.MinimumCostFlow Compute the minimum-cost (max) flow in a flow network.MinimumCostFlow.Builder A builder forMinimumCostFlow
objects.MinimumDirectedSpanningTree Minimum spanning tree algorithm for directed graphs.MinimumDirectedSpanningTree.Builder A builder forMinimumDirectedSpanningTree
objects.MinimumEdgeCutAllST Minimum Edge-Cut algorithm that finds all minimum edge-cuts in a graph between two terminal vertices (source-sink, S-T).MinimumEdgeCutAllST.Builder A builder forMinimumEdgeCutAllST
objects.MinimumEdgeCutGlobal Global Minimum Edge-Cut algorithm without terminal vertices.MinimumEdgeCutGlobal.Builder A builder forMinimumEdgeCutGlobal
objects.MinimumEdgeCutST Minimum Edge-Cut algorithm with terminal vertices (source-sink, S-T).MinimumEdgeCutST.Builder A builder forMinimumEdgeCutST
objects.MinimumMeanCycle Algorithm that find the cycle with the minimum mean weight.MinimumMeanCycle.Builder A builder forMinimumMeanCycle
objects.MinimumSpanningTree Minimum spanning tree algorithm.MinimumSpanningTree.Builder A builder forMinimumSpanningTree
objects.MinimumSpanningTree.IResult A result object forMinimumSpanningTree
computation forIntGraph
.MinimumSpanningTree.Result<V,E> A result object forMinimumSpanningTree
computation.MinimumVertexCutAllGlobal Minimum Vertex-Cut algorithm that finds all minimum vertex-cuts in a graph (global vertex-cut).MinimumVertexCutAllGlobal.Builder A builder forMinimumVertexCutAllGlobal
objects.MinimumVertexCutAllST Minimum Vertex-Cut algorithm that finds all minimum vertex-cuts in a graph between two terminal vertices (source-sink, S-T).MinimumVertexCutAllST.Builder A builder forMinimumVertexCutAllST
objects.MinimumVertexCutGlobal Minimum Vertex-Cut algorithm without terminal vertices.MinimumVertexCutGlobal.Builder A builder forMinimumVertexCutGlobal
objects.MinimumVertexCutST Minimum Vertex-Cut algorithm with terminal vertices (source-sink, S-T).MinimumVertexCutST.Builder A builder forMinimumVertexCutST
objects.Path<V,E> A path of edges in a graph.RandomizedAlgorithm Randomized algorithm interface.ShortestPathAllPairs An algorithm that compute all pairs shortest path (APSP) in a graph.ShortestPathAllPairs.Builder A builder forShortestPathAllPairs
objects.ShortestPathAllPairs.IResult A result object for anShortestPathAllPairs
algorithm forIntGraph
.ShortestPathAllPairs.Result<V,E> A result object for anShortestPathAllPairs
algorithm.ShortestPathHeuristicST Shortest path algorithm that uses a distance heuristic function.ShortestPathHeuristicST.Builder A builder forShortestPathHeuristicST
objects.ShortestPathSingleSource Single Source Shortest Path algorithm.ShortestPathSingleSource.Builder A builder forShortestPathSingleSource
objects.ShortestPathSingleSource.IResult A result object for theShortestPathSingleSource
problem forIntGraph
.ShortestPathSingleSource.Result<V,E> A result object for theShortestPathSingleSource
problem.ShortestPathST An algorithm for computing the shortest path between two vertices in a graph.ShortestPathST.Builder A builder forShortestPathST
objects.SimplePathsEnumerator An algorithm that enumerate over simple paths between a source and a target.SimplePathsEnumerator.Builder A builder forSimplePathsEnumerator
objects.SteinerTreeAlgo An algorithm for the Steiner tree problem.SteinerTreeAlgo.Builder A builder forSteinerTreeAlgo
objects.SteinerTreeAlgo.IResult A result object forSteinerTreeAlgo
computation forIntGraph
.SteinerTreeAlgo.Result<V,E> A result object forSteinerTreeAlgo
computation.StronglyConnectedComponentsAlgo Strongly Connected components algorithm.StronglyConnectedComponentsAlgo.Builder A builder forStronglyConnectedComponentsAlgo
objects.TopologicalOrderAlgo Algorithm that calculate a topological order of graph vertices.TopologicalOrderAlgo.Builder A builder forTopologicalOrderAlgo
objects.TopologicalOrderAlgo.IResult A result object of aTopologicalOrderAlgo
algorithm forIntGraph
.TopologicalOrderAlgo.Result<V,E> A result object of aTopologicalOrderAlgo
algorithm.TreePathMaxima Tree Path Maxima (TPM) algorithm.TreePathMaxima.Builder A builder forTreePathMaxima
objects.TreePathMaxima.IQueries Queries container forTreePathMaxima
computations forIntGraph
.TreePathMaxima.IResult A result object forTreePathMaxima
algorithm forIntGraph
.TreePathMaxima.Queries<V,E> Queries container forTreePathMaxima
computations.TreePathMaxima.Result<V,E> A result object forTreePathMaxima
algorithm.TspMetric Metric Traveling Salesman Problem (TSP) algorithm.VertexBiPartition<V,E> A partition of the vertices of a graph into two blocks.VertexCover Minimum weighted vertex cover algorithm.VertexCover.Builder A builder forVertexCover
algorithms.VertexPartition<V,E> A partition of the vertices of a graph.VoronoiAlgo Voronoi cells algorithm.VoronoiAlgo.Builder A builder forVoronoiAlgo
algorithms.VoronoiAlgo.IResult A result object ofVoronoiAlgo
computation forIntGraph
.VoronoiAlgo.Result<V,E> A result object ofVoronoiAlgo
computation.WeaklyConnectedComponentsAlgo Weakly Connected components algorithm.WeaklyConnectedComponentsAlgo.Builder A builder forWeaklyConnectedComponentsAlgo
objects. -
Class Summary Class Description BipartiteGraphs Static class for bipartite graphs.GraphsUtils Static methods class for graphs.Trees Static methods class for tree graphs.TspMetricMatchingAppx TSP \(3/2\)-approximation using maximum matching.TspMetricMSTAppx TSP \(2\)-approximation using MST. -
Enum Summary Enum Description EdgeDirection The direction type of an edge with respect to a vertex.