晚上好,正如我对其他有关Library Jung2 Java的问题所做的那样,在没有具体文件和时间的情况下,我想请求帮助。
在这种情况下,由于我的代码,我想知道是否有一种颜色从Graph的特定节点传出的所有边缘的颜色,因为它是特定问题的答案。
提前谢谢。
UndirectedGraph<String, String> graphStruct = new UndirectedSparseMultigraph<String, String>();
Hashtable<String, NodeData> nodeCollection = new Hashtable<String, NodeData>();
Hashtable<String, EdgeData> edgeCollection = new Hashtable<String, EdgeData>();
...
...
...
edgeCollection.put(""+edge, new EdgeClass(edge, "Id+"+edge));
...
...
...
VisualizationViewer<String, String> vv = new VisualizationViewer<String, String>(new FRLayout<String, String>(graphStruct));
vv.getRenderContext().setVertexFillPaintTransformer(new VertexColor(nodeCollection));
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller<String>());
vv.getRenderContext().setVertexLabelTransformer(new NodeId(nodeCollection));
JLabel label = new JLabel();
label.setOpaque(true);
label.setText("Graph");
vv.add(label);
PluggableGraphMouse inter = new PluggableGraphMouse();
inter.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON3_MASK));
inter.add(new PickingGraphMousePlugin());
inter.add(new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, 2 / 1.2f, 1.2f));
vv.setGraphMouse(inter);
vv.setPreferredSize(new Dimension(1600,1000));
vv.setLocation(500, 500);
vv.setGraphLayout(new CircleLayout(graphStruct));
final JFrame frame = new JFrame();
frame.setTitle("Graph Rappresentation");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(vv);
frame.pack();
frame.setVisible(true);