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
0
votes
1 answer

How to generate clear graph with jgrapht with very big number of vertices that don't overlap each other

I am working on generating a graph with Java using jgraph and jgrapht libraries. The problem is that my graph has a very big number of vertices (varying from 300 to 1000 in some cases) and no matter what I try, vertices and edges keep on overlapping…
0
votes
1 answer

Java jframe jgraph scroll plane

I can't figure out how to put scroll bar for my jrame or should I try to put inside of the jgraph? I tried different things but it either doesn't compile or doesn't show up or it covers the graph? main java final GraphMain applet=new…
MAXGEN
  • 735
  • 1
  • 10
  • 21
0
votes
1 answer

Java jgraph applet visualize bipartite graph

I having problem getting jgrapht or jgraph or applet to visualize this graph correctly? Can I use this graph library to visualize similarly to the picture beneath? U would be x and V would be Y in the code for example. I'm using the demo versions…
MAXGEN
  • 735
  • 1
  • 10
  • 21
0
votes
1 answer

JAVA Jgrapht Hopcroft Karp Bipartite Matching

I'm trying to make a HopcroftKarpBipartiteMatching but none of demos or I can't really find anything else to help me with using the library. I can't figure out from documentation how and what is required to instantiate the…
MAXGEN
  • 735
  • 1
  • 10
  • 21
0
votes
1 answer

Is it possible to create a connected graph with a certain redundancy level?

I was looking at jgraphT but I am not very experienced and it lacks a bit in documentation. I have some nodes and I'd like to create a connected topology giving some redundancy. Example: I start with n1,n2,n3,n4 I would like to be able to…
Phate
  • 6,066
  • 15
  • 73
  • 138
0
votes
0 answers

JGrapht SimpleDirectedWeightedGraph class addEdge return null pointer (with all nodes are not null)

When I implemented constructing a graph (graph-cut algorithm in Markov Random Field),I do not know why when the Source node and target node are not null, why addEdge() function does not work and returns a null in one operation. Moreover,for the…
Juliet_sj
  • 1
  • 1
0
votes
2 answers

Design pattern for prioritization of graph nodes

Problem to solve: give a priority (int value) to all the nodes of a graph. There is a DAG class with an attribute Graph (of type DirectedGraph from JGraphT library). Moreover, there must be different algorithms to assign priorities, and it must be…
capovawi
  • 377
  • 8
  • 21
0
votes
1 answer

How Does AbstractBaseGraph#getEdge(V,V) Deal with Parallel Edges?

AbstractBaseGraph#getEdge(V,V) returns a single E. How does it decide which edge to return if the two vertices passed have more than one connecting edge?
hendryau
  • 426
  • 3
  • 14
0
votes
1 answer

Updating the edge weight displayed without being "cluncky"

I am using Jgrapht to build a simulation environment based on a directed weighted graph. I now want to display the simulation using Jgraph. While I have figured out how to display the graph and update it as the simulation runs, I have noticed that…
Destruktor
  • 463
  • 1
  • 4
  • 19
0
votes
0 answers

How to run HelloJGraphT.java

I've added the JGraphtT to my classpath in netbeans IDE, I've done this by right clicking on Libraries and adding the Jar File/Folder. But whenever I then access the file it shadows out the run button at the top of my screen. Does anyone know how…
Grant
  • 446
  • 6
  • 24
0
votes
2 answers

Formula to convert vertex potions into proportions relative to States of America?

I am using a JGraphModelAdapter to convert a Jgraph to a JGrapht. Its working fine and my vertices are displayed on the gui as they should. I have been given some base code to work with when editing the positions of the vertices on the GUI. (Seen…
Noob
  • 145
  • 2
  • 9
0
votes
1 answer

NullPointerException and MouseListener in a graph

I am trying to use this code to change the opacity of some vertices connected to the vertex clicked in a jgraphx, and when you click somewhere outside the vertices it will rechange the opacity. When a vertex is clicked, its value/string is queried…
user2598911
  • 379
  • 2
  • 6
  • 22
0
votes
2 answers

java.lang.InstantiationException using jGraphT when trying to display the Weight of a lable

Hi everyone I'm tring to display a graph using jGraphT. Instead of labling an edge with the name of the source and target notes I want to display the weight of the edge. For that, I created an aditional class to overwrite the toString method of…
an3sarmiento
  • 323
  • 4
  • 13
0
votes
1 answer

Java: edit and recompile .jar?

I downloaded JGraphT, and I want to make some changes to the core files. I'm using Eclipse. It wants a .jar or .zip to attach source files to the .class file. I have the .java file, but I'm not sure what I should do. Do I edit it, then recompile the…
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
0
votes
2 answers

Java: .equals() failing for sets (JGraphT)

I can't figure out what's going wrong here. This test fails: @Test public void testSimpleCase() { assertTrue(JGraphtUtilities.graphEquality(ChooseRootTest.generateSimpleCaseGraph(), ChooseRootTest.generateSimpleCaseGraph())); …
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699