jung

How to manually set the zoom on a Jung visualisation?

落爺英雄遲暮 提交于 2019-12-01 20:39:36
I have a jung tree displayed in a JPanel. The constructor of my tree looks like this: Forest<String, Integer> graph = new DelegateForest<String, Integer>(); static GraphZoomScrollPane panel = null; static DefaultModalGraphMouse graphMouse = null; static JComboBox modeBox = null; static ScalingControl scaler; public PanelTree(List<Cluster> clist) { setBounds(215, 10, 550, 550); updateData(clist); // adds vertex and edges to graph treeLayout = new TreeLayout<String, Integer>(graph); vv = new VisualizationViewer<String, Integer>(treeLayout, new Dimension(500, 500)); vv.setBackground(Color.white);

JUNG: placing tree nodes in order

让人想犯罪 __ 提交于 2019-12-01 11:58:59
问题 When adding nodes to my DelegateTree , they don't appear visually in the order I added them. I've been looking for a solution, but haven't found anything yet. Is there anyone who might know how to change this? Thanks in advance! EDIT : My code /** * Generate a visualization of the decision tree. * * @param tree * The decision tree * @return A component to be placed inside a JPanel */ public static GraphZoomScrollPane generateTree(Tree tree, GraphicalUserInterface gui) { /* Create a new tree *

JUNG: save whole graph (not only visible part) as image

人走茶凉 提交于 2019-11-30 05:24:16
I've been looking around for solutions to my question, but nothing does exactly what I want. What I want to do is save a whole JUNG graph (with custom vertex and edge rendering) to an image (PNG or JPEG). When I save the VisualizationViewer to a BufferedImage, it only takes the visible part. I want to save the whole graph, so that's not an option. Does anyone have an idea on how to render my whole graph to an image? Thanks in advance! I finally found the solution to my problem, using a VisualizationImageServer . Here is an example of how to create an image from a whole JUNG graph, for others

Change Size/Color of Vertex in JUNG

一个人想着一个人 提交于 2019-11-30 03:41:13
How do you change the size of a specific vertex in Jung Visualization Library? I'm reading the documentation but I'm not extremely familiar with java and I can't find any good examples on line. It took me a while, but here is a readable, fully-commented program that changes the vertex size and color in a graph. Enjoy! public class SimpleGraphView { public SimpleGraphView() { // Create a graph with Integer vertices and String edges Graph<Integer, String> g = new SparseGraph<Integer, String>(); for(int i = 0; i < 5; i++) g.addVertex(i); g.addEdge("Edge", 1, 2); g.addEdge("Another Edge", 1, 4); /

How do I install Jung2 on eclipse?

人走茶凉 提交于 2019-11-28 14:03:50
http://jung.sourceforge.net/ Can someone walk through the steps carefully for me? I have been trying for hours and I can't seem to get it. I'm using a Mac. And, I want to be able to use the Jung2 libraries while programming, using the Eclipse IDE. @Rohan: JUNG 2.0 Framework contains both binary and source form of jars. To use the binary jars from JUNG, you need to add them as Referenced Libraries in a project. Create a new project. Then, add required JUNG jars somewhere inside project directory. Refresh project tree. Right-click on each JUNG jar to add it to Build Path > Add to Build Path in

Vertex label in JUNG graph visualization

女生的网名这么多〃 提交于 2019-11-28 11:25:40
I wrote a little graph visualizer class: public void simpleGraph(SparseMultigraph<Vertex,SEdge> graph, String name) { Layout<Vertex, SEdge> layout = new ISOMLayout(graph); layout.setSize(new Dimension(800,800)); BasicVisualizationServer<Vertex, SEdge> vv = new BasicVisualizationServer<Vertex, SEdge>(layout); vv.setPreferredSize(new Dimension(850,850)); //Sets the viewing area size JFrame frame = new JFrame(name); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(vv); frame.pack(); frame.setVisible(true); } How can I add labels for vertices and edges? The Values

Exporting JUNG graphs to hi-res images (preferably vector based)

蹲街弑〆低调 提交于 2019-11-27 14:12:42
In one of my projects I use JUNG2 to visualize a very large multiple-parent hierarchy graph, displayed in an applet. I would need to export the whole/parts of the graph to high resolution still images, since screenshots look hideous when printed (especially if the graph has been zoomed out). The code I use currently is as follows: public void writeToDisk(File saveToFolder, String filename) { //Dimension loDims = getGraphLayout().getSize(); Dimension vsDims = getSize(); int width = vsDims.width; int height = vsDims.height; Color bg = getBackground(); BufferedImage im = new BufferedImage(width