Prefuse
Prefuse is a set of software tools for creating rich interactive data visualizations in the Java programming language. Prefuse supports a rich set of features for data modeling, visualization, and interaction. It provides optimized data structures for tables, graphs, and trees, a host of layout and visual encoding techniques, and support for ani…
prefuse | interactive information visualization toolkit
The Prefuse toolkit haven't been updated since 2009 and the last build is from 2007. Is there any other Java visualization packages as powerful as Prefuse but has active community support/development?
Source: (StackOverflow)
I am using the prefuse visualization toolkit, The GraphView Demo in the toolkit is amazing providing a variety of controls to visualize the data.
I am able to generate GraphML for my dataset and visualize it using GraphView, One additional thing that i would love to have is to label the edges with weights or color coding to demonstrate the strength between two nodes.
Any input about the same are greatly appreciated..Thanks..
Source: (StackOverflow)
I'm new to prefuse (java) and would like to display edges labels in a graph.
I've been searching for this but could not find the solution.
Any idea about this ?
Many thanks,
Raphaël
Source: (StackOverflow)
I have a data structure that represents a directed graph and I'm looking for a good Silverlight visualisation to allow me to navigate from node to node, preferably with some nice animation.
Does anyone know of any good UI controls or frameworks for this kind of display? Even a sample from another field (maybe a social network?). My graphs don't have many nodes so performance won't be an issue.
I've seen the Prefuse library for Java (and Flash) which would be ideal. The "Degree of Interest" visualisation is the kind of thing I'm after, but I can't find anything in Silverlight.
Thanks for any tips.
Source: (StackOverflow)
which of the open source Java graph drawing frameworks to use for a network diagram with the following requirements? The graph will have less than 1000 nodes.
1) has parallel edges
2) directed and undirected edges within a single graph
3) nodes represented by images
4) user interaction with nodes and edges
5) dynamically adding/deleting nodes and edges
6) multiple labelling on nodes and edges , different levels of labelling can be turned off/on by users. (like drawing in layers and turning off / on a layer)
7) different layout algorithms to display star, ring, mesh topologies
I evaluated JUNG and Prefuse. This is what I found for each of my requirements.
1) Prefuse cannot display parallel edges while JUNG supports it. Can prefuse code be manipulated to display parallel edges ? Since this involves basic data level changes I believe this would be more difficult that the usual customized rendering changes.
2) I didnt find any reference to combined graph (both directed and undirected edges) in both prefuse and JUNG. Does anyone know otherwise?
3) This seems easy with both Prefuse and JUNG
4) Again both prefuse and JUNG provides support for user interaction.
5) Both prefuse and JUNG supports it. How does each framework perform while redrawing the graph ? I saw in another post that prefuse does not perform well for dynamic updates (Prefuse Toolkit: dynamically adding nodes and edges)
6) This comes down to modifying the graph and redrawing it. So the question becomes the same as 5)
7) Both JUNG and prefuse has multiple layout algorithms. But When I tried to display the same dataset using FruchtermanReingoldLayout in both JUNG and Prefuse I get different displays. Any ideas why ? Somehow the layout algorithms in Prefuse seem to display a better layout than in JUNG (rendering is also better I think) though most of the layout algorithms in Prefuse are based on JUNG implementation.
Prefuse layouts such as ForceDirectedLayout/FruchtermanReingoldLayout and CircleLayout directly maps to star,circle, mesh topologies.
Outside of these requirements, prefuse has good support for expressions and query language but looks like it is not actively developed unlike JUNG. which one has better visualization? Any suggestions on which one will be suitable and how to overcome the shortcomings ?
Any other frameworks out there which I can use ?
Source: (StackOverflow)
I have a huge XML file (measuring nearly 2GB) formatted in the Graphml XML format for a social graph. While creating a new graph via
graph = new GraphMLReader().readGraph("socialgraph.xml");
I get a "java.lang.OutOfMemoryError: Java heap space" exception
Is there a way in prefuse to read the file, node by node.
If not, can you recommend me some visualization toolkits that can handle such large sizes via XML or SQL databases.
Source: (StackOverflow)
I am developing a graphical view of data using PREFUSE library.
I have 3 kinds of nodes in my graph:
- APPLICATION
- DATABASE
- INTERFACE
Below are some excerpts from my .xml file containing graph
<node id="AP-1">
<data key="name">Application1</data>
<data key="type">APPLICATION</data>
</node>
<node id="DB-1">
<data key="name">Database1</data>
<data key="type">DATABASE</data>
</node>
<node id="IT-1">
<data key="name">Interface1</data>
<data key="type">INTERFACE</data>
</node>
I want to show the above 3 diff. kinds of nodes with 3 diff. kinds of shapes as follows:
- APPLICATION by Rectangle
- DATABASE by custom shape (shape of a cylinder, usually used to denote a database)
- INTERFACE by circle
I have first read the .xml file in a
Graph g
Q1. Now how can I distinguish these 3 kinds of nodes in a datagroup. I think I should write predicates. I have read the whole predicates and expressions manuals for prefuse but couldn't write a predicate to distinguish them. So what will be the predicate for that?
Q2. How to specify my custom shape and how to set a renderer that can render the custom shape developed by me?
Source: (StackOverflow)
I am looking for any of the following (in order of preference):
Sample implementations include:
Do you know where to find something along those lines?
Source: (StackOverflow)
I am a new to the prefuse visualization toolkit and have a couple of general questions. For my purpose, I would like to perform an initial visualization using prefuse (graphview / graphml). Once rendered, upon a user click of a node, I would like to completely reload a new xml file for a new visualization. I want to do this in order to allow me to "pre-package" graphs for display.
For example. If I search for Ted. I would like to have an xml file relating to Ted load and render a display. Now in the display I see that Ted has nodes associated called Bill and Joe. When I click Joe, I would like to clear the display and load an xml file associated with Joe. And so on.
I have looked into loading one very large xml file containing all node and node relationship info and allowing prefuse to handle this using the hops from one level to another. However, eventually I am sure that system performance issues will arise due to the size of data.
Thanks in advance for any help,
John
Source: (StackOverflow)
I was able to create a single bar graph using the code from Samir Talwar by modifying the renderer as the following:
vis.setRendererFactory(new RendererFactory() {
Renderer yAxisRenderer = new AxisRenderer(Constants.RIGHT, Constants.TOP);
Renderer xAxisRenderer = new AxisRenderer(Constants.CENTER, Constants.FAR_BOTTOM);
Renderer barRenderer = new ShapeRenderer() {
protected Shape getRawShape(VisualItem item) {
double x = item.getX();
double y = item.getY();
if (Double.isNaN(x) || Double.isInfinite(x))
x = getInsets().left + axisWidth + totalBarWidth / 2;
if (Double.isNaN(y) || Double.isInfinite(y))
y = 0;
double width = totalBarWidth / (barCount + 1) - barGap;
double height = getHeight() - getInsets().bottom - axisHeight - y;
x -= width / 2;
item.setFillColor(item.getStrokeColor());
return rectangle(x, y, width, height);
}
};
public Renderer getRenderer(VisualItem item) {
return item.isInGroup("ylab") ? yAxisRenderer :
item.isInGroup("xlab") ? xAxisRenderer :
barRenderer;
}
Anyhow, I have tried look on the possibility on creating clustered bar graphs where there are multiple bar for a single value but having difficulties. Also, the reason why I do not use JFreechart is because I need prefuse's filtering and searching functions which prove to be very useful in terms of analysis in my research.
Source: (StackOverflow)
I'm trying to creating a Graph instance in Prefuse through the following approach:
Graph(Table nodes, Table edges, boolean directed)
/*
Create a new Graph, using node table row numbers to uniquely identify nodes in the edge table's source and target fields.
*/
So I create a Table object to store the nodes and edges data like this.However, this is a problem:
Table nodes=new Table(2,3);
//here is the error eclipse reports:integer can't be resolved to a variable
nodes.addColumn("id",integer);
nodes.addColumn("name", String);
nodes.addColumn("gender", String);
nodes.addRows(4);
nodes.set(0, 0, 1);
nodes.set(0, 1, "Abbas");
nodes.set(0, 2, "M");
nodes.set(1, 0, 2);
nodes.set(1, 1, "Hassan");
nodes.set(1, 2, "F");
The API describes the method "addColumn" as
public void addColumn(java.lang.String name,
java.lang.Class type)
Add a column with the given name and data type to this table.
Thank you!
Source: (StackOverflow)
I've currently got prefuse to plot a scatter graph, where the X axis is the computer name and the Y axis is its temperature. How do I get it to draw bars showing the values instead of discrete points?
I'm currently using the following code to render the points:
ShapeAction shape = new ShapeAction(group, Constants.SHAPE_RECTANGLE);
ColorAction strokeColor = new DataColorAction(group, dataType, Constants.NUMERICAL, VisualItem.STROKECOLOR, colorPalette);
ActionList draw = new ActionList();
draw.add(shape);
draw.add(strokeColor);
draw.add(new ColorAction(group, VisualItem.FILLCOLOR, 0));
draw.add(new RepaintAction());
m_vis.putAction("draw", draw);
How would I adapt this code to get, instead of a small square at each point, a thick bar going from th bottom of the graph to the point?
Thanks.
Source: (StackOverflow)
So I need an automatic grid layout algorithm with "orthogonal" edges of some Java objects.
Something like this.
I'd be given some matrix from which I will create a graph instance (in Eclipse) and my output is layout of that graph (it would be very nice if the output would be some kind of xml file containing coordinates of vertices and edge, but it's not necessary).
(Requirements are like that because our object is some kind of UML class diagram that will be in that matrix and we want layout similar to classic UML diagrams).
I found class SimpleGridLayout in some earlier package of JGraph, but its usage is strongly discouraged and I cannot find API.
I looked through Zest, Jung, JGraphx, Prefuse and none contains wanted layout: Zest doesn't have orthogonal edges, Jung doesn't have grid layout, Prefuse doesn't have grid (graph) layout, JGraphx is somewhat complicated and I cannot really find my way around it.
It seems like these packages are really rich and certainly it can be made manually in them, but due to the nature of project, some automated algorithm is wanted.
All suggestions are welcomed.
Source: (StackOverflow)
I did my homework and searched both google for a sample and a topic that is answered before on stackoverflow. But nothing has been found.
My problem is ordinary edges who does not have a view like arrows.
Here is what i do to hope there is forward arrows from target to destination:
LabelRenderer nameLabel = new LabelRenderer("name");
nameLabel.setRoundedCorner(8, 8);
DefaultRendererFactory rendererFactory = new DefaultRendererFactory(nameLabel);
EdgeRenderer edgeRenderer;
edgeRenderer = new EdgeRenderer(prefuse.Constants.EDGE_TYPE_LINE, prefuse.Constants.EDGE_ARROW_FORWARD);
rendererFactory.setDefaultEdgeRenderer(edgeRenderer);
vis.setRendererFactory(rendererFactory);
Here is what i see about colour of edges, hoping these must not be transparent:
int[] palette = new int[]{ColorLib.rgb(255, 180, 180), ColorLib.rgb(190, 190, 255)};
DataColorAction fill = new DataColorAction("socialnet.nodes", "gender", Constants.NOMINAL, VisualItem.FILLCOLOR, palette);
ColorAction text = new ColorAction("socialnet.nodes", VisualItem.TEXTCOLOR, ColorLib.gray(0));
ColorAction edges = new ColorAction("socialnet.edges", VisualItem.STROKECOLOR, ColorLib.gray(200));
ColorAction arrow = new ColorAction("socialnet.edges", VisualItem.FILLCOLOR, ColorLib.gray(200));
ActionList colour = new ActionList();
colour.add(fill);
colour.add(text);
colour.add(edges);
colour.add(arrow);
vis.putAction("colour", colour);
Thus, i wonder where am i wrong?
Why my edges do not seem like arrows?
Thanks for any idea.
For more detail, i want to paste all of the code:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package prefusedeneme;
import javax.swing.JFrame;
import prefuse.data.*;
import prefuse.data.io.*;
import prefuse.Display;
import prefuse.Visualization;
import prefuse.render.*;
import prefuse.util.*;
import prefuse.action.assignment.*;
import prefuse.Constants;
import prefuse.visual.*;
import prefuse.action.*;
import prefuse.activity.*;
import prefuse.action.layout.graph.*;
import prefuse.controls.*;
import prefuse.data.expression.Predicate;
import prefuse.data.expression.parser.ExpressionParser;
public class SocialNetworkVis {
public static void main(String argv[]) {
// 1. Load the data
Graph graph = null;
/* graph will contain the core data */
try {
graph = new GraphMLReader().readGraph("socialnet.xml");
/* load the data from an XML file */
} catch (DataIOException e) {
e.printStackTrace();
System.err.println("Error loading graph. Exiting...");
System.exit(1);
}
// 2. prepare the visualization
Visualization vis = new Visualization();
/* vis is the main object that will run the visualization */
vis.add("socialnet", graph);
/* add our data to the visualization */
// 3. setup the renderers and the render factory
// labels for name
LabelRenderer nameLabel = new LabelRenderer("name");
nameLabel.setRoundedCorner(8, 8);
/* nameLabel decribes how to draw the data elements labeled as "name" */
// create the render factory
DefaultRendererFactory rendererFactory = new DefaultRendererFactory(nameLabel);
EdgeRenderer edgeRenderer;
edgeRenderer = new EdgeRenderer(prefuse.Constants.EDGE_TYPE_LINE, prefuse.Constants.EDGE_ARROW_FORWARD);
rendererFactory.setDefaultEdgeRenderer(edgeRenderer);
vis.setRendererFactory(rendererFactory);
// 4. process the actions
// colour palette for nominal data type
int[] palette = new int[]{ColorLib.rgb(255, 180, 180), ColorLib.rgb(190, 190, 255)};
/* ColorLib.rgb converts the colour values to integers */
// map data to colours in the palette
DataColorAction fill = new DataColorAction("socialnet.nodes", "gender", Constants.NOMINAL, VisualItem.FILLCOLOR, palette);
/* fill describes what colour to draw the graph based on a portion of the data */
// node text
ColorAction text = new ColorAction("socialnet.nodes", VisualItem.TEXTCOLOR, ColorLib.gray(0));
/* text describes what colour to draw the text */
// edge
ColorAction edges = new ColorAction("socialnet.edges", VisualItem.STROKECOLOR, ColorLib.gray(200));
ColorAction arrow = new ColorAction("socialnet.edges", VisualItem.FILLCOLOR, ColorLib.gray(200));
/* edge describes what colour to draw the edges */
// combine the colour assignments into an action list
ActionList colour = new ActionList();
colour.add(fill);
colour.add(text);
colour.add(edges);
colour.add(arrow);
vis.putAction("colour", colour);
/* add the colour actions to the visualization */
// create a separate action list for the layout
ActionList layout = new ActionList(Activity.INFINITY);
layout.add(new ForceDirectedLayout("socialnet"));
/* use a force-directed graph layout with default parameters */
layout.add(new RepaintAction());
/* repaint after each movement of the graph nodes */
vis.putAction("layout", layout);
/* add the laout actions to the visualization */
// 5. add interactive controls for visualization
Display display = new Display(vis);
display.setSize(700, 700);
display.pan(350, 350); // pan to the middle
display.addControlListener(new DragControl());
/* allow items to be dragged around */
display.addControlListener(new PanControl());
/* allow the display to be panned (moved left/right, up/down) (left-drag)*/
display.addControlListener(new ZoomControl());
/* allow the display to be zoomed (right-drag) */
// 6. launch the visualizer in a JFrame
JFrame frame = new JFrame("prefuse tutorial: socialnet");
/* frame is the main window */
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.add(display);
/* add the display (which holds the visualization) to the window */
frame.pack();
frame.setVisible(true);
/* start the visualization working */
vis.run("colour");
vis.run("layout");
}
}
Source: (StackOverflow)