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

JGraphT GetPath throws NullPointerException

Hi i'm building a big project, using JGraphT. For this I have built a method that returns the shortest path between two sets of nodes, using Djikstra's class from JGraphT. I get NullPointerException when I try to access path or it's submethods. …
serkef
  • 319
  • 2
  • 13
0
votes
1 answer

Manipulating large graphs using JGraph

I have an acyclic graph that has about 100,000 nodes. I want to be able to edit the graph and basically visualize it by zooming in and out of portions. My Question: Is JgraphT a suitable candidate for this type of an application?
user1172468
  • 5,306
  • 6
  • 35
  • 62
0
votes
1 answer

How to randomly pick a vertex or edge from graph of jGraphT

I have created a Graph with a set of edges I have (4000K Edges and 4K nodes). Now I want to take 10% of the edges from the corpus to create a train and test data set. I want to pick an edge in random, verify if the vertices of this edge has an edge…
TechCrunch
  • 2,924
  • 5
  • 45
  • 79
0
votes
1 answer

Jgrapht edge color

I would like to change the color of my edges using Jgrapht so that I can show the correspondence in my whole graph. Let us assume there is an edge between nodes 1 and 2. I will highlight these nodes in (say) red color. I will find nodes 1 and 2 in…
Ramesh
  • 765
  • 7
  • 24
  • 52
0
votes
1 answer

Remove all edges touching a given vertex

So I'm trying to remove all edges of a SimpleGraph (undirected graph, JGraphT) but for some reason I keep getting ConcurrentModificationException. Here's what I'm trying to do: First, I have a class Point as fowllowed: class Point { private int…
0x56794E
  • 20,883
  • 13
  • 42
  • 58
0
votes
1 answer

How do I add the jgrapht library to my system?

This is probably a silly question, but how or where do I add jgrapht so my java compiler in terminal will include it? I've got the .jar file but don't know where to put it. I'm using Mac OS X ML and Netbeans.
Jay Jenkins
  • 413
  • 1
  • 5
  • 15
0
votes
1 answer

JGraphT - UndirectedGraph - addEdge method does not work

I have a problem about UndirectedGraph usage. My code : UndirectedGraph graph = new SimpleGraph(DefaultEdge.class); String v1 = "v1"; String v2 = "v2"; String v3 = "v3"; String v4 = "v4"; …
iremce
  • 570
  • 4
  • 14
  • 25
-1
votes
1 answer

ConcurrentModificationException using Collectors.toSet()

I have a Set that I want to filter by class to obtain a Set (i.e., the subset of Objects that are instanceof Foo). To do this with Java-8 I wrote Set filtered = initialSet.parallelStream().filter(x -> (x instanceof Foo)).map(x ->…
LJ in NJ
  • 196
  • 1
  • 1
  • 12
-1
votes
1 answer

Build GraphPath from list of vertices

Is there a way in which I can build a GraphPath of one graph using just its list of vertices to create a path from another graph in SimpleDirectedWeightedGraph? For example, lets say i do a .getVertexList() on a path from tempGraphand i wish to…
Criss Hills
  • 189
  • 1
  • 12
-1
votes
1 answer

How can I find the shortest cycle in a Directed, Weighted Graph?

I am looking for the easiest way to find the shortest cycle in a graph.
Ann
  • 1
  • 2
-1
votes
1 answer

How to get items from Hashsets of a List?

I'm using ConnectivityInspector to get the connected trees from a graph using the method connectedSets() which give me a List of Hashsets ConnectivityInspector s = new ConnectivityInspector<>(graph); …
zain
  • 1
-1
votes
1 answer

Finding Hamiltonian path and Hamiltonian cycle

I have a SimpleGraph in JGraphT and want to know if there is a Hamiltonian path a Hamiltonian cycle And if one exists I'd also like to get it. I only found TwoApproxMetricTSP and HamiltonianCycle. But both require complete graphs. One obvious…
Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
-1
votes
1 answer

Error when using predecessorListOf in jgrapht

I created a digraph using the jgrapht libray, added some vertices and edges. I can't manage to make the predecessorListOf method work in my program. I made a very simple one to try to find the issue but same problem, it says that the function…
Graham Slick
  • 6,692
  • 9
  • 51
  • 87
-1
votes
1 answer

Java program doesn't display text from another class (graphs)

So it's probably something wrong with my Flight class, but I can't figure out what exactly. I'm trying to display flight info, but only the airports are being shown when I run it (try Edinburgh -> Toronto). Here's my main class: import…
-1
votes
3 answers

plotting a graph

Hi there I am quite new to java, however I need to plot a graph in JApplet. I have managed to declare all variables and classes, the equation is working (when compiled on it's own). but all I get is a strait line! can anyone tell me what am I…
user1527093
  • 19
  • 1
  • 1
1 2 3
20
21