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

Retrieve "n-1" and "n+1" element of each position in a for loop

I have a digraph (created using the jgrapht library) which takes as vertices Point objects. I add vertices and edges as a flood fill algorithm goes through a given matrix. I created it using this code: public static DirectedGraph
Graham Slick
  • 6,692
  • 9
  • 51
  • 87
3
votes
2 answers

More efficient way to prune a directed acyclic graph in jgrapht?

I am looking for a more efficient way to prune a directed acyclic graph (a DAG) constructed in jgrapht. The DAG represents the relationships between a set of network conversations in time. The parents of a conversation are any conversations which…
Ken Pronovici
  • 774
  • 1
  • 8
  • 20
3
votes
2 answers

Undirected Graphs in JGraphX

I try to show graphs in JGraphx. Everything is fine as long as I use directed Graphs, but when I try to show an undirected one, its shown with direction. The code is from the demo of jgrapht. package org.jgrapht.demo; import…
Torben Ha
  • 45
  • 1
  • 5
3
votes
2 answers

Java: Why does this method have side effects?

I have a method that is producing side effects, even though certain variables are marked final. Why is this? Perhaps I am confused about what final does. @Test public void testSubGraph() { WeightedGraph g =…
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
3
votes
1 answer

Java: Prim's with Fibonacci heap? (JGraphT)

JGraphT has a nice Fibonacci Heap class. How can I use it to implement Prim's minimum spanning tree algorithm?
Nick Heiner
  • 119,074
  • 188
  • 476
  • 699
3
votes
2 answers

JgraphT export to dot file

I am building a project on graph theory algorithms and for this I use JGraphT. I have built completely my graph and I work on it the past couple of months. Now I want to export it so I can visualize it in Gephi. I don't want to use JGraph and Java…
serkef
  • 319
  • 2
  • 13
3
votes
2 answers

ClosestFirstIterator with "max hops" cap per path

I am trying to use JgraphT to create a network graph for a redundant topology, and I'm interested in getting the closest node to another node, but the topology doesn't allow above a certain amount of hops to avoid loops. I was wondering if there is…
Noqet
  • 33
  • 2
3
votes
2 answers

Algorithm for Graph/Data Structure on Java

I have been working on the following problem where, I have a CSV file with two columns, we can say the filed names are "Friends". Both the columns contain letters from A to Z. e.g. A B B C A E D F E F Each row has two different letters(no…
Pankaj Gadge
  • 351
  • 1
  • 3
  • 5
3
votes
2 answers

Get certain nodes out of a Parse Tree

I am working on a project involving anaphora resolution via Hobbs algorithm. I have parsed my text using the Stanford parser, and now I would like to manipulate the nodes in order to implement my algorithm. At the moment, I don't understand how…
Tex
  • 950
  • 1
  • 10
  • 22
2
votes
1 answer

JGraph(T) graph element selection customization

I have as some problem with using JGraph(T) library. I need change default selection view, example: default background is orange color, if vertex selected then green border was added, can i change this visualization strategy to change background to…
2
votes
1 answer

Topological sort with detecting vertices that have equal priorities with JGraphT

I introduced JGraphT library to my project and I'm constructing a directed graph of some resources to create with their dependencies. I'm going to use topological sort to determine an order of creation to pass it to other component. I'd like to…
Przemysław Różycki
  • 809
  • 2
  • 10
  • 21
2
votes
0 answers

Get all Paths between 2 Nodes in a simple graph using JGraphT

I' m currently studying the JGraphT libraries to manipulate Graphs in Java, in particular I'm trying to identify the longest path between 2 nodes in a simple graph and I know that I can get there by using a recursive method. Anyway, I found in Java…
lfmvit
  • 21
  • 1
2
votes
1 answer

Does this look like an efficient way to find vertices which have no outgoing edges in a graph (JGrapthT)?

I am using JGraphT for holding about 150,000 (or thereabouts) vertices in an in-memory graph. This a directed graph and each vertex is going to have { 0 | 1 } outgoing edges. I want to find retrieve the set of vertices which have no outgoing edges.…
Nirmalya
  • 717
  • 9
  • 19
2
votes
3 answers

JGraph in a JFrame

I want to draw some graphs including vertices and edges in my application. I found that JGraph is a good library for plotting graphs. I went through some online sources about it but couldn't find any relevant articles about how to embed a JGraph in…
Nuwan
  • 360
  • 3
  • 8
  • 20
2
votes
2 answers

how to use Graph Theory for scheduling execution order?

I am designing an application, which executes a series of plugins. A plugin's execution might/might not be dependent on another/other plugins execution. i.e some (not all) of the plugins expect other plugin(s) to be executed before it begins its…
vasanth
  • 130
  • 1
  • 2
  • 11
1 2
3
20 21