public void testSwitchMapTransformer() { Transformer a = TransformerUtils.constantTransformer("A"); Transformer b = TransformerUtils.constantTransformer("B"); Transformer c = TransformerUtils.constantTransformer("C"); Map map = new HashMap(); map.put("HELLO", a); map.put("THERE", b); assertEquals(null, TransformerUtils.switchMapTransformer(map).transform("WELL")); assertEquals("A", TransformerUtils.switchMapTransformer(map).transform("HELLO")); assertEquals("B", TransformerUtils.switchMapTransformer(map).transform("THERE")); map.put(null, c); assertEquals("C", TransformerUtils.switchMapTransformer(map).transform("WELL")); assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchMapTransformer(new HashMap())); map = new HashMap(); map.put(null, null); assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.switchMapTransformer(map)); try { TransformerUtils.switchMapTransformer(null); fail(); } catch (IllegalArgumentException ex) { } }
@Override public void actionPerformed(ActionEvent e) { GraphViewerPanel viewerPanel = (GraphViewerPanel) frame.getTabbedPane().getSelectedComponent(); if(viewerPanel.isEdgeLabel()){ viewerPanel.getVisualizationViewer().getRenderContext().setEdgeLabelTransformer(new ConstantTransformer(null)); viewerPanel.getVisualizationViewer().repaint(); viewerPanel.setEdgeLabel(false); } else{ viewerPanel.getVisualizationViewer().getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<String>()); viewerPanel.getVisualizationViewer().repaint(); viewerPanel.setEdgeLabel(true); } }
/** * Creates a minimum spanning forest from the supplied graph, populating the * supplied Forest, which must be empty. * If the supplied root is null, or not present in the Graph, * then an arbitrary Graph vertex will be selected as the root. * If the Minimum Spanning Tree does not include all vertices of the * Graph, then a leftover vertex is selected as a root, and another * tree is created * @param graph the Graph to find MST in * @param forest the Forest to populate. Must be empty * @param root first Tree root, may be null */ @SuppressWarnings("unchecked") public MinimumSpanningForest(Graph<V, E> graph, Forest<V,E> forest, V root) { if(forest.getVertexCount() != 0) { throw new IllegalArgumentException("Supplied Forest must be empty"); } this.graph = graph; this.forest = forest; this.weights = LazyMap.decorate(new HashMap<E,Double>(), new ConstantTransformer(1.0)); Set<E> unfinishedEdges = new HashSet<E>(graph.getEdges()); if(graph.getVertices().contains(root)) { this.forest.addVertex(root); } updateForest(forest.getVertices(), unfinishedEdges); }
private Layout<Node, Edge> newLayout(final Diagram diagram) { final Layout<Node, Edge> diagramLayout; if (layout != null && layout.startsWith("spring")) { diagramLayout = new SpringLayout<Node, Edge>(diagram, new ConstantTransformer(Integer.parseInt(config("spring", "100")))); } else if (layout != null && layout.startsWith("kk")) { Distance<Node> distance = new DijkstraDistance<Node, Edge>(diagram); if (layout.endsWith("unweight")) { distance = new UnweightedShortestPath<Node, Edge>(diagram); } diagramLayout = new KKLayout<Node, Edge>(diagram, distance); } else if (layout != null && layout.equalsIgnoreCase("circle")) { diagramLayout = new CircleLayout<Node, Edge>(diagram); } else if (layout != null && layout.equalsIgnoreCase("fr")) { diagramLayout = new FRLayout<Node, Edge>(diagram); } else { final LevelLayout levelLayout = new LevelLayout(diagram); levelLayout.adjust = adjust; diagramLayout = levelLayout; } return diagramLayout; }
/** * */ public VisualizationImageServerDemo() { // create a simple graph for the demo graph = new DirectedSparseMultigraph<String, Number>(); String[] v = createVertices(10); createEdges(v); vv = new VisualizationImageServer<String,Number>(new KKLayout<String,Number>(graph), new Dimension(600,600)); vv.getRenderer().setVertexRenderer( new GradientVertexRenderer<String,Number>( Color.white, Color.red, Color.white, Color.blue, vv.getPickedVertexState(), false)); vv.getRenderContext().setEdgeDrawPaintTransformer(new ConstantTransformer(Color.lightGray)); vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray)); vv.getRenderContext().setArrowDrawPaintTransformer(new ConstantTransformer(Color.lightGray)); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); vv.getRenderer().getVertexLabelRenderer().setPositioner(new InsidePositioner()); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.AUTO); // create a frome to hold the graph final JFrame frame = new JFrame(); Container content = frame.getContentPane(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Image im = vv.getImage(new Point2D.Double(300,300), new Dimension(600,600)); Icon icon = new ImageIcon(im); JLabel label = new JLabel(icon); content.add(label); frame.pack(); frame.setVisible(true); }
public void testConstantTransformer() { assertEquals(cObject, TransformerUtils.constantTransformer(cObject).transform(null)); assertEquals(cObject, TransformerUtils.constantTransformer(cObject).transform(cObject)); assertEquals(cObject, TransformerUtils.constantTransformer(cObject).transform(cString)); assertEquals(cObject, TransformerUtils.constantTransformer(cObject).transform(cInteger)); assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.constantTransformer(null)); }
public void testMapTransformer() { Map map = new HashMap(); map.put(null, new Integer(0)); map.put(cObject, new Integer(1)); map.put(cString, new Integer(2)); assertEquals(new Integer(0), TransformerUtils.mapTransformer(map).transform(null)); assertEquals(new Integer(1), TransformerUtils.mapTransformer(map).transform(cObject)); assertEquals(new Integer(2), TransformerUtils.mapTransformer(map).transform(cString)); assertEquals(null, TransformerUtils.mapTransformer(map).transform(cInteger)); assertSame(ConstantTransformer.NULL_INSTANCE, TransformerUtils.mapTransformer(null)); }
@Override public void actionPerformed(ActionEvent e) { GraphViewerPanel viewerPanel = (GraphViewerPanel) frame.getTabbedPane().getSelectedComponent(); if(viewerPanel.isVertexLabel()){ viewerPanel.getVisualizationViewer().getRenderContext().setVertexLabelTransformer(new ConstantTransformer(null)); viewerPanel.getVisualizationViewer().repaint(); viewerPanel.setVertexLabel(false); } else{ viewerPanel.getVisualizationViewer().getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>()); viewerPanel.getVisualizationViewer().repaint(); viewerPanel.setVertexLabel(true); } }
public TreePane(Dominoes domino) { // create a simple graph for the demo graph = new DelegateForest<>(); graph.addVertex(domino.getHistoric()); this.createTree(domino.getHistoric()); treeLayout = new TreeLayout<>(graph); final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); vv = new VisualizationViewer<>(treeLayout, new Dimension(600, 600)); vv.setBackground(Color.white); vv.getRenderContext().setVertexFillPaintTransformer(new ConstantTransformer(Color.GRAY)); vv.getRenderContext().setEdgeFillPaintTransformer(new ConstantTransformer(Color.BLACK)); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); vv.setGraphMouse(graphMouse); // add a listener for ToolTips vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.WHITE)); SwingNode s = new SwingNode(); s.setContent(vv); this.getChildren().add(s); }
/** * Creates a <code>VertexShapeFactory</code> with a constant size of * 10 and a constant aspect ratio of 1. */ @SuppressWarnings("unchecked") public VertexShapeFactory() { this(new ConstantTransformer(10), new ConstantTransformer(1.0f)); }
/** * Calculates betweenness scores based on the all-pairs unweighted shortest paths * in the graph. * @param graph the graph for which the scores are to be calculated */ @SuppressWarnings("unchecked") public BetweennessCentrality(Graph<V, E> graph) { initialize(graph); computeBetweenness(new LinkedList<V>(), new ConstantTransformer(1)); }
/** * Creates an instance for the specified graph, vertex priors, and random * jump probability (alpha). The edge weights default to 1.0. * @param g the input graph * @param vertex_priors the prior probability for each vertex * @param alpha the probability of a random jump at each step */ @SuppressWarnings("unchecked") public HITSWithPriors(Hypergraph<V,E> g, Transformer<V, HITS.Scores> vertex_priors, double alpha) { super(g, new ConstantTransformer(1.0), vertex_priors, alpha); disappearing_potential = new HITS.Scores(0,0); }
@SuppressWarnings({ "unchecked", "rawtypes" }) private Transformer<V, Shape> getShape() { Transformer<V, Shape> vertexShapeTransformer = new ConstantTransformer( new Ellipse2D.Float(-currentSize, -currentSize, currentSize * 2, currentSize * 2)); return vertexShapeTransformer; }
public JPanel startFunction() { Graph<Integer,Number> g = getGraph(); Layout<Integer,Number> layout = new FRLayout<Integer,Number>(g); // layout.setSize(new Dimension(5000,5000)); vv = new VisualizationViewer<Integer,Number>(layout); PickedState<Integer> picked_state = vv.getPickedVertexState(); // affineTransformer = vv.getLayoutTransformer(); self_loop = new SelfLoopEdgePredicate<Integer,Number>(); // create decorators seedFillColor = new SeedFillColor<Integer>(picked_state); seedDrawColor = new SeedDrawColor<Integer>(picked_state); ewcs = new EdgeWeightStrokeFunction<Number>(edge_weight); vsh = new VertexStrokeHighlight<Integer,Number>(g, picked_state); vff = new VertexFontTransformer<Integer>(); eff = new EdgeFontTransformer<Number>(); vs_none = new ConstantTransformer(null); es_none = new ConstantTransformer(null); vssa = new VertexShapeSizeAspect<Integer,Number>(g, voltages); show_edge = new DirectionDisplayPredicate<Integer,Number>(true, true); show_arrow = new DirectionDisplayPredicate<Integer,Number>(true, false); show_vertex = new VertexDisplayPredicate<Integer,Number>(false); // uses a gradient edge if unpicked, otherwise uses picked selection edgeDrawPaint = new GradientPickedEdgePaintFunction<Integer,Number>( new PickableEdgePaintTransformer<Number>( vv.getPickedEdgeState(),Color.black,Color.cyan), vv); edgeFillPaint = new GradientPickedEdgePaintFunction<Integer,Number>( new PickableEdgePaintTransformer<Number>( vv.getPickedEdgeState(),Color.black,Color.cyan), vv); vv.getRenderContext().setVertexFillPaintTransformer(seedFillColor); vv.getRenderContext().setVertexDrawPaintTransformer(seedDrawColor); vv.getRenderContext().setVertexStrokeTransformer(vsh); vv.getRenderContext().setVertexLabelTransformer(vs_none); vv.getRenderContext().setVertexFontTransformer(vff); vv.getRenderContext().setVertexShapeTransformer(vssa); vv.getRenderContext().setVertexIncludePredicate(show_vertex); vv.getRenderContext().setEdgeDrawPaintTransformer( edgeDrawPaint ); vv.getRenderContext().setEdgeLabelTransformer(es_none); vv.getRenderContext().setEdgeFontTransformer(eff); vv.getRenderContext().setEdgeStrokeTransformer(ewcs); vv.getRenderContext().setEdgeIncludePredicate(show_edge); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line<Integer,Number>()); vv.getRenderContext().setEdgeArrowPredicate(show_arrow); vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray)); vv.getRenderContext().setArrowDrawPaintTransformer(new ConstantTransformer(Color.black)); JPanel jp = new JPanel(); jp.setLayout(new BorderLayout()); vv.setBackground(Color.white); GraphZoomScrollPane scrollPane = new GraphZoomScrollPane(vv); jp.add(scrollPane); gm = new DefaultModalGraphMouse<Integer, Number>(); vv.setGraphMouse(gm); gm.add(new PopupGraphMousePlugin()); addBottomControls( jp ); vssa.setScaling(true); vv.setVertexToolTipTransformer(new VoltageTips<Number>()); vv.setToolTipText("<html><center>Use the mouse wheel to zoom<p>Click and Drag the mouse to pan<p>Shift-click and Drag to Rotate</center></html>"); return jp; }
@Override public void init() { //create a graph Graph<Number,Number> ig = Graphs.<Number,Number>synchronizedDirectedGraph(new DirectedSparseMultigraph<Number,Number>()); ObservableGraph<Number,Number> og = new ObservableGraph<Number,Number>(ig); og.addGraphEventListener(new GraphEventListener<Number,Number>() { public void handleGraphEvent(GraphEvent<Number, Number> evt) { System.err.println("got "+evt); }}); this.g = og; //create a graphdraw layout = new FRLayout2<Number,Number>(g); // ((FRLayout)layout).setMaxIterations(200); vv = new VisualizationViewer<Number,Number>(layout, new Dimension(600,600)); JRootPane rp = this.getRootPane(); rp.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE); getContentPane().setLayout(new BorderLayout()); getContentPane().setBackground(java.awt.Color.lightGray); getContentPane().setFont(new Font("Serif", Font.PLAIN, 12)); vv.getModel().getRelaxer().setSleepTime(500); vv.setGraphMouse(new DefaultModalGraphMouse<Number,Number>()); vv.getRenderer().getVertexLabelRenderer().setPosition(Renderer.VertexLabel.Position.CNTR); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<Number>()); vv.setForeground(Color.white); getContentPane().add(vv); switchLayout = new JButton("Switch to SpringLayout"); switchLayout.addActionListener(new ActionListener() { @SuppressWarnings("unchecked") public void actionPerformed(ActionEvent ae) { Dimension d = new Dimension(600,600); if (switchLayout.getText().indexOf("Spring") > 0) { switchLayout.setText("Switch to FRLayout"); layout = new SpringLayout<Number,Number>(g, new ConstantTransformer(EDGE_LENGTH)); layout.setSize(d); vv.getModel().setGraphLayout(layout, d); } else { switchLayout.setText("Switch to SpringLayout"); layout = new FRLayout<Number,Number>(g, d); vv.getModel().setGraphLayout(layout, d); } } }); getContentPane().add(switchLayout, BorderLayout.SOUTH); timer = new Timer(); }
public void InitiateGraph(Character[] cs, Template[] templates, Color[] colors, String[] picture_keys, String[] extra_keys) { Map<CharacterNode, Icon> iconMap = new HashMap<CharacterNode, Icon>(); characters = new CharacterNode[cs.length]; for (int x = 0; x < cs.length; x++) { characters[x] = new CharacterNode(cs[x]); for (int y = 0; y < templates.length; y++) { if (cs[x].templateIdentifier.equals(templates[y].GetTemplateID())) { characters[x].color = colors[y]; characters[x].extra_key = extra_keys[y]; ImageIcon img = XEED.RescaleImageIcon((ImageIcon) cs[x].imgData.get(picture_keys[y]), ImageMaxSize, ImageMaxSize); if (img != null) { iconMap.put(characters[x], new LayeredIcon(img.getImage())); } } } } // creates the graph graph = new DelegateForest<CharacterNode, Integer>(); //Loads the tree data createTree(); //Sets up the transformer that paints the node. Transformer<CharacterNode, Paint> vertexPaint = new Transformer<CharacterNode, Paint>() { @Override public Paint transform(CharacterNode cn) { ; return cn.color; } }; final DefaultVertexIconTransformer<CharacterNode> vertexIconFunction = new DefaultVertexIconTransformer<CharacterNode>(); vertexIconFunction.setIconMap(iconMap); final VertexIconShapeTransformer<CharacterNode> vertexImageShapeFunction = new VertexIconShapeTransformer<CharacterNode>( new EllipseVertexShapeTransformer<CharacterNode>()); vertexImageShapeFunction.setIconMap(iconMap); treeLayout = new TreeLayout<CharacterNode, Integer>(graph, TreeLayout.DEFAULT_DISTX * 3); //Skriva en anpassad metod för att bestämma platser. //använd treeLayout.setLocation(); vv = new VisualizationViewer<CharacterNode, Integer>(treeLayout); vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); vv.getRenderContext().setVertexShapeTransformer(vertexImageShapeFunction); vv.getRenderContext().setVertexIconTransformer(vertexIconFunction); // add a listener for ToolTips vv.setVertexToolTipTransformer(new ToStringLabeller()); vv.getRenderContext().setArrowFillPaintTransformer(new ConstantTransformer(Color.lightGray)); vv.getRenderContext().setVertexFillPaintTransformer(vertexPaint); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.AUTO); Container content = this; final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); content.add(panel); panel.setVisible(true); content.validate(); final DefaultModalGraphMouse graphMouse = new DefaultModalGraphMouse(); vv.setGraphMouse(graphMouse); graphMouse.setMode(ModalGraphMouse.Mode.TRANSFORMING); }
@SuppressWarnings({ "rawtypes", "unchecked" }) public static void render(Node tree) { // Grafo Factory<DirectedGraph<Node, Integer>> factory = DirectedOrderedSparseMultigraph .<Node, Integer> getFactory(); graph = new DelegateTree<Node, Integer>(factory); // Adiciona os v�rtices ao grafo graph.addVertex(tree); build(tree); // Layout TreeLayout<Node, Integer> layout = new TreeLayout<Node, Integer>(graph, 75, 50); // Visualiza��o VisualizationViewer<Node, Integer> vv = new VisualizationViewer<Node, Integer>( layout); VertexLabelAsShapeRenderer<Node, Integer> vlasr = new VertexLabelAsShapeRenderer<Node, Integer>( vv.getRenderContext()); /* V�rtices */ // Cor da borda vv.getRenderContext().setVertexDrawPaintTransformer( new ConstantTransformer(Color.black)); // Cor de fundo vv.getRenderContext().setVertexFillPaintTransformer( new ConstantTransformer(Color.lightGray)); // R�tulo como string vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller()); // Formato retangular vv.getRenderContext().setVertexShapeTransformer(vlasr); // Posiciona texto dentro vv.getRenderer().setVertexLabelRenderer(vlasr); /* Arestas */ // Remove a seta da aresta vv.getRenderContext().setEdgeArrowPredicate( new Predicate<Context<Graph<Node, Integer>, Integer>>() { @Override public boolean evaluate( Context<Graph<Node, Integer>, Integer> arg0) { return false; } }); // Formato da linha vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); // Habilita suporte ao mouse final DefaultModalGraphMouse<Node, Integer> graphMouse = new DefaultModalGraphMouse<Node, Integer>(); vv.setGraphMouse(graphMouse); // Cria a janela do JFrame JFrame jf = new JFrame(); jf.getContentPane().add(vv); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setTitle("Abstract Syntax Tree"); jf.pack(); jf.setExtendedState(JFrame.MAXIMIZED_BOTH); jf.setVisible(true); }
private void createPanel() { final GraphZoomScrollPane panel = new GraphZoomScrollPane(vv); this.setLayout(new BorderLayout()); this.add(panel); AbstractModalGraphMouse graphMouse = createModalGraphMouse(); vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller<String>()); vv.getRenderContext().setVertexLabelRenderer(new MyDefaultVertexLabelRenderer(Color.BLACK, Color.RED)); vv.getRenderContext().setEdgeLabelTransformer(new ConstantTransformer(null)); vv.getRenderContext().setEdgeLabelRenderer(new MyDefaultEdgeLabelRenderer(Color.BLACK, Color.RED)); vv.getRenderContext().setLabelOffset(18); setEdgeLabel(false); setVertexLabel(true); vv.setGraphMouse(graphMouse); vv.setToolTipText("<html><center>Type 'p' for Pick mode<p>Type 't' for Transform mode"); final ScalingControl scaler = new CrossoverScalingControl(); JToggleButton mouseModeButton = createMouseModeButton(graphMouse); JButton plus = createZoomInButton(scaler); JButton minus = createZoomOutButton(scaler); createFilterCombo(jComboBox); JComboBox hopsCombo = createHopsCombo(); JButton update = createUpdateButton(); JButton reload = createReloadButton(); JButton saveView = createSaveButton(); JButton loadView = createLoadButton(); JButton redraw = createRedrawAroundButton(); controls = new JPanel(); controls.add(saveView); controls.add(loadView); controls.add(mouseModeButton); controls.add(jComboBox); controls.add(update); controls.add(reload); controls.add(plus); controls.add(minus); controls.add(hopsCombo); controls.add(redraw); controls.add(createCaptureButton()); this.add(controls, BorderLayout.SOUTH); if (!entireGraph.containsVertex(initialNode)) { applyFilter(currentFilter, currentHops); } else { SetPickedState(initialNode); Set<String> vertexes = new HashSet<String>(); vertexes.add(initialNode); applyFilter(currentFilter, currentHops, vertexes); } }
@SuppressWarnings("unchecked") public AbstractVertexShapeTransformer() { this(new ConstantTransformer(DEFAULT_SIZE), new ConstantTransformer(DEFAULT_ASPECT_RATIO)); }
/** * Creates an instance which generates a minimum spanning tree assuming constant edge weights. */ public PrimMinimumSpanningTree(Factory<? extends Graph<V,E>> factory) { this(factory, new ConstantTransformer(1.0)); }
protected VisualizationViewer<VisualNode, VisualEdge> SetViewers(Layout<VisualNode, VisualEdge> layout, HecataeusViewer viewer) { this.viewer = viewer; vv = new VisualizationViewer<VisualNode, VisualEdge>(layout); Dimension prefferedSize = Toolkit.getDefaultToolkit().getScreenSize(); vv = new VisualizationViewer<VisualNode, VisualEdge>(layout); vv.setSize(new Dimension((int)prefferedSize.getWidth()/2,(int)prefferedSize.getHeight()/2)); vv.setBackground(Color.white); vv.setPickSupport(new LayoutLensShapePickSupport<VisualNode, VisualEdge>(vv)); vv.setVertexToolTipTransformer(new VisualNodeToolTips()); vv.setEdgeToolTipTransformer(new VisualEdgeToolTips()); // the labels of the Vertices vv.getRenderContext().setVertexLabelTransformer(new VisualNodeLabel()); vv.getRenderer().getVertexLabelRenderer().setPosition(Position.AUTO); vv.getRenderContext().setEdgeStrokeTransformer(new ConstantTransformer(new BasicStroke(0.1f))); // the fonts of the vertices vv.getRenderContext().setVertexFontTransformer(new VisualNodeFont(new Font(Font.SANS_SERIF, Font.PLAIN, 13))); //node size //the shape of the edges vv.getRenderContext().setEdgeShapeTransformer(new EdgeShape.Line()); //quad // the labels of the Edges vv.getRenderContext().setEdgeLabelTransformer(new VisualEdgeLabel()); // call the setVertexPaintFunction to paint the nodes vv.getRenderContext().setVertexFillPaintTransformer(new VisualNodeColor(vv.getPickedVertexState())); //set edge color vv.getRenderContext().setEdgeDrawPaintTransformer(new VisualEdgeDrawColor(vv.getPickedEdgeState())); // call the setEdgePaintFunction to paint the edges vv.getRenderContext().setEdgeFillPaintTransformer( new VisualEdgeColor(vv.getPickedEdgeState())); // call the setVertexShapeFunction to set the shape of the nodes vv.getRenderContext().setVertexShapeTransformer(new VisualNodeShape()); // call the setNodeVisible to set the shape of the nodes according to vv.getRenderContext().setVertexIncludePredicate(new VisualNodeVisible()); vv.getRenderContext().setVertexIconTransformer(new VisualNodeIcon()); // double amount = 1.0; // ScalingControl scaler = new CrossoverScalingControl(); // scaler.scale(vv, amount > 0 ? 1.1f : 1 / 1.1f, vv.getCenter()); vv.getRenderContext().getMultiLayerTransformer().addChangeListener(vv); HecataeusModalGraphMouse gm = new HecataeusModalGraphMouse(); gm.HecataeusViewerPM(viewer); vv.setGraphMouse(gm); vv.addGraphMouseListener(gm); return vv; }
/** * <p>Creates an instance of <code>DijkstraShortestPath</code> for * the specified unweighted graph (that is, all weights 1) which * caches results locally. * * @param g the graph on which distances will be calculated */ @SuppressWarnings("unchecked") public DijkstraDistance(Graph<V,E> g) { this(g, new ConstantTransformer(1), true); }
/** * <p>Creates an instance of <code>DijkstraShortestPath</code> for * the specified unweighted graph (that is, all weights 1) which * caches results locally. * * @param g the graph on which distances will be calculated * @param cached specifies whether the results are to be cached */ @SuppressWarnings("unchecked") public DijkstraDistance(Graph<V,E> g, boolean cached) { this(g, new ConstantTransformer(1), cached); }
/** * Constructor for a SpringLayout for a raw graph with associated * dimension--the input knows how big the graph is. Defaults to the unit * length function. */ @SuppressWarnings("unchecked") public SpringLayout(Graph<V,E> g) { this(g, new ConstantTransformer(30)); }
/** * <p>Creates an instance of <code>DijkstraShortestPath</code> for * the specified unweighted graph (that is, all weights 1) which * caches results locally. * * @param g the graph on which distances will be calculated */ @SuppressWarnings("unchecked") public DijkstraDistance(Hypergraph<V,E> g) { this(g, new ConstantTransformer(1), true); }
/** * <p>Creates an instance of <code>DijkstraShortestPath</code> for * the specified unweighted graph (that is, all weights 1) which * caches results locally. * * @param g the graph on which distances will be calculated * @param cached specifies whether the results are to be cached */ @SuppressWarnings("unchecked") public DijkstraDistance(Hypergraph<V,E> g, boolean cached) { this(g, new ConstantTransformer(1), cached); }