Questions tagged [jgrapht]

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

JGraphT supports various types of graphs including:

  • directed and undirected graphs.
  • graphs with weighted / unweighted / labeled or any user-defined edges.
  • various edge multiplicity options, including: simple-graphs, multigraphs, pseudographs.
  • unmodifiable graphs - allow modules to provide "read-only" access to internal graphs.
  • listenable graphs - allow external listeners to track modification events.
  • subgraphs graphs that are auto-updating subgraph views on other graphs.
  • all compositions of above graphs. Although powerful, JGraphT is designed to be simple and type-safe (via Java generics). For example, graph vertices can be of any objects. You can create graphs based on: Strings, URLs, XML documents, etc; you can even create graphs of graphs! This code example shows how.

Other features offered by JGraphT:

  • graph visualization using the JGraph library
  • complete source code included, under the terms of the GNU Lesser General Public License.
  • comprehensive Javadocs.
  • easy extensibility.

Official website: http://jgrapht.org/

303 questions
2
votes
1 answer

JGraphT: calculate Graph intersection

Using JGraphT, is it possible to calculate the intersection (difference/delta) of two Graph objects? Are there any other java graph libraries which can help me solving my problem?
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
2
votes
1 answer

Extending SimpleWeightedGraph - JgraphT

I wanted to know about the right way to extend the SimpleWeightedGraph from JgraphT library so that I could use a simplified alias and also include additional functionalities as required. Instead of creating a new graph each time…
Steve
  • 45
  • 5
2
votes
1 answer

Saving in-memory graph representation in database

I have a dynamic graph changing over time and I am using Jgrapht library to store each instance of the graph in memory using UndirectedGraph timeGraph = new SimpleGraph(DefaultEdge.class); As it is intensive to…
Steve
  • 45
  • 5
2
votes
1 answer

Equivalent to JGraph for JavaFX8?

I want to port an old swing tool which uses an also old version of JGraph to JavaFX8. However, since JGraph is a Swing-Based library, is thought about replacing it, too. So, is there something equivalent to JGraph, but working with JavaFX8?
grackkle
  • 776
  • 1
  • 9
  • 26
2
votes
0 answers

JGraphT - how to modify graph with Topological sort (not asking how to iterate topologically!)

Does JGraphT has ability to run a Topological Sort on a graph that will purge forward edges (or at least label them as such) and the resulting graph will have accessible root list of nodes (top level nodes of all trees in the graph)
Andrey
  • 21
  • 1
2
votes
1 answer

How to refer to custom Vertexes to add an Edge, using JGraphT

I have a graph SimpleWeightedGraph g where Vertex is a custom class. I have all the vertexes and the edges in a postgresql spatial db.I need to load only a subset of them, to find a path from two vertexes, so I use some…
Merlinux
  • 23
  • 3
2
votes
0 answers

Equal vertex in a jGraphT DirectedWeightedMultigraph

I want to have a DirectedWeightedMultigraph with "customized" Vertex and Edges. With this code, I would like to have only three vertices because v1 and v4 have the same key, but I have four. DirectedWeightedMultigraph graph =…
bkm
  • 259
  • 3
  • 8
2
votes
1 answer

How to make Treelayout graph in Java

I am working to a program that reads some xml files and creates graph diagram based on information in those xml files. I have difficulties in making the graph diagram. I want that my graph to…
2
votes
1 answer

Java JGrapht Bipartite graph

I seen examples of jgraph and jgrapht and there easy to follow but now sure how I would go about using the CompleteBipartiteGraph? How is the syntax to be used to instantiate the…
MAXGEN
  • 735
  • 1
  • 10
  • 21
2
votes
3 answers

Import JGraphT distribution to Eclipse

How can I install the JGraphT distribution offered in this link: http://sourceforge.net/projects/jgrapht/files/ I do not understand the tree structure of files and its relation with the structure of a project in Eclipse. I would like to run the java…
capovawi
  • 377
  • 8
  • 21
2
votes
0 answers

Convert graph between JGraphT and OrientDB

I use OrientDB to store graph data but it has few graph algorith and can not process weighted graph so I want to use JGraphT. Is there any tool to automatically convert between 2 types of graph. After process in JGraphT graph, I want to save back to…
2
votes
1 answer

Getting Weighted Graphs to Work in JGraphT

Why am I getting a NULL pointer error for this program, as far as I can see everything looks fine, I've just started using JGraphT and need a little help with it. Context: I need to be able to add flights to the graph, each flight is bi-directional…
Conner Stephen McCabe
  • 581
  • 4
  • 10
  • 20
2
votes
1 answer

JGraphT - maximum independent set

I have this code for making the undirected graph: UndirectedGraph g = new SimpleGraph(DefaultEdge.class); g.addVertex("1"); g.addVertex("2"); g.addVertex("3"); g.addVertex("4"); g.addEdge("1", "3"); g.addEdge("1", "4"); g.addEdge("2",…
Skav
  • 346
  • 4
  • 11
2
votes
0 answers

How to use jgrapht?

I have a problem using JGraphT to visualize graphs. I use netBeans and I have imported .jar for JGraph and JGraphT and copied everything from JGraphT Visualizations via JGraph and added this code: private void…
L H
  • 77
  • 1
  • 4
2
votes
1 answer

JGraphT: Stack overflow error with Liao Wong longest path algorithm?

I'm trying to implement a longest path algorithm in Java with jGraphT, but i get an java.lang.StackOverflowError when i compile. The error message point to the line where i copy the graph and to the line where the method calls itself inside the…
Whiteface
  • 21
  • 2