jung

How do I initialize vertex locations in a custom JUNG layout?

时间秒杀一切 提交于 2019-12-08 14:28:22
问题 How do I initialize a new layout with vertex positions known beforehand? I have created a custom JUNG layout class: public class CustomLayout extends AbstractLayout { AbstractLayout subLayout = null; final int WIDTH = 500; final int HEIGHT = 500; public CustomLayout(Graph<Vertex, Edge> graph, Transformer<Vertex, Point2D> init) { super(graph, init); for (Vertex v : this.getGraph().getVertices()) { // Assign each vertex a random initial position. setLocation(v, new Point2D.Double(random * WIDTH

Displaying popup messgae in Jung

别说谁变了你拦得住时间么 提交于 2019-12-08 11:17:43
问题 I have created a network which consists of number of vertexes and edges. How do I show a popup message over a vertex when I move the mouse to that vertex? 回答1: AbstractPopupGraphMousePlugin and its subclasses are what you want: http://jung.sourceforge.net/doc/api/edu/uci/ics/jung/visualization/control/AbstractPopupGraphMousePlugin.html Look for its use in PluggableRendererDemo and in GraphEditorDemo. (Other samples also use it; those samples show how to create subclasses.) 来源: https:/

How to use PageRank algorithm in JUNG?

雨燕双飞 提交于 2019-12-08 05:40:58
问题 I am using JUNG as my tool to visualize network graph and compute network attributes(ex: indegree, outdegree, and pagerank). I know JUNG already implemented PageRank algorithm, but there were no instruction on using pagerank algorithm in the manual(http://jung.sourceforge.net/doc/index.html). Does anyone knows how to do it? I also tried the following code, but it came out an error " Vertex CLP Holdings Ltd not an element of this graph ". public void calcPageRank() { PageRank<MyNode, MyLink>

JUNG2 - how to set custom egde color/thick transformer

妖精的绣舞 提交于 2019-12-07 16:23:20
问题 In my app i want to set every egde with diffrent style. It can be edge colour or edge thickness. I've read about transformers in JUNG, but i didn't find anytging useful. Do you know any way to set specific colour or line thickness to specific edge? It can be some kind of Transformer or class having methods like setWidth() or setColour(). Example would be nice;) 回答1: Thank's, and here is working example: private Transformer<String, Paint> edgePaint = new Transformer<String, Paint>() { public

port JUNG into GWT [closed]

烈酒焚心 提交于 2019-12-07 11:19:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . there is a very good java graphing library JUNG I wonder if there exists any GWT library that does what JUNG do ? i'm aware there exist a commercial Javascript graphing library mxGraph. But mxGraph is very expensive and have a very restrictive licensing policy. does anyone knows of any GWT graphing library

Pop-up menu using mouse rightclick in JUNG

时光总嘲笑我的痴心妄想 提交于 2019-12-07 07:36:15
问题 I want to create a pop-up menu, which will appear if i right clicked on the canvas . How can I do this? which function should i modify? Any help would be appreciated. 回答1: Following code will create a popup menu when right-clicking either on the vertex or on the canvas... /** * a GraphMousePlugin that offers popup * menu support */ protected class PopupGraphMousePlugin extends AbstractPopupGraphMousePlugin implements MouseListener { public PopupGraphMousePlugin() { this(MouseEvent.BUTTON3

How to animate drawing edges with JUNG

六眼飞鱼酱① 提交于 2019-12-06 15:49:55
I'm new to JUNG I have a FRLayout that represents a network topology with key nodes or vertices that are color as red and the other vertices blue The edges from the starting node to the end node are blue I want to be to demonstrate an animation of the path to the end node. How can animate drawing the edges from a start_node to end_node with a specified time interval? Can you provide or reference an example? You could attach a keyframe to your Edge data. Then, every time you draw (using a transformer) you can use the keyframe to adjust the gradient of the edge: RenderContext<V, E> context = vv

port JUNG into GWT [closed]

跟風遠走 提交于 2019-12-05 16:52:52
there is a very good java graphing library JUNG I wonder if there exists any GWT library that does what JUNG do ? i'm aware there exist a commercial Javascript graphing library mxGraph . But mxGraph is very expensive and have a very restrictive licensing policy. does anyone knows of any GWT graphing library similar to mxGraph (JS) or JUNG( java)? if there is no GWT library for graphing like JUNG, I'm keen on porting JUNG into GWT. I was thinking to use gwt-graphics library as a basis and extend it with more JUNG like features . what is a good strategy to port JUNG into GWT? should i rewrite

Pop-up menu using mouse rightclick in JUNG

﹥>﹥吖頭↗ 提交于 2019-12-05 12:01:34
I want to create a pop-up menu, which will appear if i right clicked on the canvas . How can I do this? which function should i modify? Any help would be appreciated. Following code will create a popup menu when right-clicking either on the vertex or on the canvas... /** * a GraphMousePlugin that offers popup * menu support */ protected class PopupGraphMousePlugin extends AbstractPopupGraphMousePlugin implements MouseListener { public PopupGraphMousePlugin() { this(MouseEvent.BUTTON3_MASK); } public PopupGraphMousePlugin(int modifiers) { super(modifiers); } /** * If this event is over a

How to programatically pan a VisualizationViewer with Jung (the java library)?

不想你离开。 提交于 2019-12-05 10:10:35
问题 After a lot a investigations, I don't achieve to find a convenient answer to the following question: how to programatically pan a VisualizationViewer with Jung? I have a GUI with the list of the vertices of my graph, and I want that a double click on one item of the list (i.e. a node description) perform a "centering action" of my VisualizationViewer for the clicked node. How to code such a behavior? it seems simple but I found no convenient answer. If someone could help, thanks! njames 回答1: