I have implemented this Graph:
ListenableDirectedWeightedGraph g =
new ListenableDirectedWeightedGraph(
MyWeightedEdge.class);
in order to show what the class name says, a simple listenable directed weighted graph. I want to change the label of the edges and instead of the format
return "(" + source + " : " + target + ")";
I wa...
I'm trying to iterate through all nodes, so I can print them out for graphviz. What is the best way to do that using the JGraphT library?
public static void main(String[] args) {
UndirectedGraph<String, DefaultEdge> g = new SimpleWeightedGraph<String, DefaultEdge>(DefaultEdge.class);
String odp = "ODP";
String cck = "CCK";
String m...
I have a problem that can essentially be viewed as a graph. I'm considering using JGraphT to implement it instead of rolling my own. What would be the best way to get a minimum spanning tree out of a graph using JGraphT?
...
JGraphT has a nice Fibonacci Heap class. How can I use it to implement Prim's minimum spanning tree algorithm?
...
I am trying to implement Prim's minimum spanning tree algorithm with JGraphT. How does it look?
One issue I ran into was JGraphT's handling of everything like it's directed. So sometimes it is necessary to make some awkward calls to reverse g.getEdgeSource(e) and g.getEdgeTarget(e) if they didn't happen to be right.
I tried to implemen...
I'm using JGraphT and I want to generate a subgraph, like this:
If there's a graph like {stuff -> a -> b -> stuff}, and you ask for the subgraph in direction of {a -> b}, you'll get {a -> b -> stuff}. (stuff = collection of nodes and edges, -> = an edge, a and b are nodes.)
My idea is as follows: if the start is A, and the sink is B, r...
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<String, DefaultWeightedEdge> g = generateSimpleCaseGraph();
Graph<String, DefaultWeightedEdge> sub = ChooseRoot.subgraphInDirection(...
I can't figure out what's going wrong here. This test fails:
@Test
public void testSimpleCase() {
assertTrue(JGraphtUtilities.graphEquality(ChooseRootTest.generateSimpleCaseGraph(), ChooseRootTest.generateSimpleCaseGraph()));
}
public static <V, E> boolean graphEquality(Graph<V, E> g0, Graph<V, E> g1) {
boolean result = ...
I'm trying to find the set of vertices that minimizes their distance to other vertices on a weighted graph. Based on a cursory wikipedia search, I think that this is called the Jordan Center. What are some good algorithms for finding it?
Right now, my plan is to get a list of the weight for each branch emanating from a given vertex. The...
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 jar?
...
Hi,
This is quite a long shot, I know it's a question about a very specific package.
I'm trying to stop nodes from dragging into a certain area of the graph.
I have written code to detect when the mouse is dragged over a node, however it is a bit of a hack. I am trying to get the node that the mouse is dragging and its XY co-ordinates...
I'm a big fan of JGraphT, a Java library for graphs. Could anyone recommend a similar Java library for trees? Preferrably FOSS.
What I need is a good API, preferrably typesafe with generics which allows modelling different kinds of trees (with some user data attached to verticies/edges) and run different algorithms and operations on the...
Hi
I am not knowing how to use the classes written in netbeans for one of my project . in which folder should i place the jgrapht package . will i have to write the import statement if yes then what do i write ?
...
Hi,
JGraphT package includes some examples to experiment oneself. HelloJGraphT.java is one of them. I can run it, without any error, in Netbeans6.0.1. But, when i use dos command prompt in the following way:
javac -cp jgrapht-jdk1.6.jar HelloJGraphT.java
it compiles. But, if i run it using:
java HelloJGraphT
it gives the fol...