public AlgorithmEventsRecorder(VehicleRoutingProblem vrp, String dgsFileLocation) { this.vrp = vrp; graph = new MultiGraph("g"); try { File dgsFile = new File(dgsFileLocation); fos = new FileOutputStream(dgsFile); fileSink = new FileSinkDGS(); if (dgsFile.getName().endsWith("gz")) { gzipOs = new GZIPOutputStream(fos); fileSink.begin(gzipOs); } else { fileSink.begin(fos); } graph.addSink(fileSink); } catch (IOException e) { e.printStackTrace(); } initialiseGraph(vrp); }
initialEdgeCapacity); setNodeFactory(new NodeFactory<MultiNode>() { public MultiNode newInstance(String id, Graph graph) { return new MultiNode((AbstractGraph) graph, id);
String objet; MultiGraph graph = new MultiGraph(g.getName(), false, true); objet = getLabel(nsm, n2); Node gsub = graph.getNode(sujetUri); if (gsub == null) { gsub = graph.addNode(sujetUri); gsub.addAttribute("label", sujet); style(n1, gsub); Node gobj = graph.getNode(objetUri); if (gobj == null) { gobj = graph.addNode(objetUri); gobj.addAttribute("label", objet); style(n2, gobj); Edge ee = graph.addEdge("edge" + num, sujetUri, objetUri, true); ee.addAttribute("label", predicat);
public void actionPerformed(ActionEvent e) { stylesheet = coreseFrame.getDefaultStylesheet(); textPaneStyleGraph.setText(stylesheet); graph.addAttribute("ui.stylesheet", stylesheet); } };
String objet; MultiGraph graph = new MultiGraph(g.getName(), false, true); objet = getLabel(nsm, n2); Node gsub = graph.getNode(sujetUri); if (gsub == null) { gsub = graph.addNode(sujetUri); gsub.addAttribute("label", sujet); if (n1.isBlank()) { Node gobj = graph.getNode(objetUri); if (gobj == null) { gobj = graph.addNode(objetUri); gobj.addAttribute("label", objet); if (n2.isBlank()) { Edge ee = graph.addEdge("edge" + num, sujetUri, objetUri, true); ee.addAttribute("label", predicat);
public void actionPerformed(ActionEvent e) { stylesheet = coreseFrame.getDefaultStylesheet(); textPaneStyleGraph.setText(stylesheet); graph.addAttribute("ui.stylesheet", stylesheet); } };
public static Graph createMultiGraph(String name, String style) { Graph g = new MultiGraph(name); g.addAttribute("ui.quality"); g.addAttribute("ui.antialias"); g.addAttribute("ui.stylesheet", style); return g; }
public void actionPerformed(ActionEvent e) { String style = textPaneStyleGraph.getText(); JTextArea areaException = new JTextArea(); StyleSheet sh = new StyleSheet(); try { sh.parseFromString(style); areaException.setText(""); excepCatch = false; } catch (Exception e1) { areaException.setText(e1.getMessage()); areaException.setEditable(false); areaException.setForeground(Color.red); JOptionPane.showMessageDialog(null, areaException, "Error Syntax", JOptionPane.WARNING_MESSAGE); excepCatch = true; } /*catch (TokenMgrError e1) { areaException.setText(e1.getMessage()); areaException.setEditable(false); areaException.setForeground(Color.red); JOptionPane.showMessageDialog(null, areaException, "Error Syntax", JOptionPane.WARNING_MESSAGE); excepCatch = true; }*/ if (!excepCatch) { graph.addAttribute("ui.stylesheet", style); textPaneStyleGraph.setText(style); stylesheet = style; } } };
initialEdgeCapacity); setNodeFactory(new NodeFactory<MultiNode>() { public MultiNode newInstance(String id, Graph graph) { return new MultiNode((AbstractGraph) graph, id);
/** * Merge several graphs in one. A new graph is created, that will contain * the result. The method will try to create a graph of the same class that * the first graph to merge (it needs to have a constructor with a String). * Else, a MultiGraph is used. * * @param graphs * graphs to merge * @return merge result */ public static Graph merge(Graph... graphs) { if (graphs == null) return new DefaultGraph("void-merge"); String id = "merge"; for (Graph g : graphs) id += "-" + g.getId(); Graph result; try { Class<? extends Graph> cls = graphs[0].getClass(); result = cls.getConstructor(String.class).newInstance(id); } catch (Exception e) { logger.warning(String.format("Cannot create a graph of %s.", graphs[0].getClass().getName())); result = new MultiGraph(id); } mergeIn(result, graphs); return result; }
public void actionPerformed(ActionEvent e) { String style = textPaneStyleGraph.getText(); JTextArea areaException = new JTextArea(); StyleSheet sh = new StyleSheet(); try { sh.parseFromString(style); areaException.setText(""); excepCatch = false; } catch (Exception e1) { areaException.setText(e1.getMessage()); areaException.setEditable(false); areaException.setForeground(Color.red); JOptionPane.showMessageDialog(null, areaException, "Error Syntax", JOptionPane.WARNING_MESSAGE); excepCatch = true; } /*catch (TokenMgrError e1) { areaException.setText(e1.getMessage()); areaException.setEditable(false); areaException.setForeground(Color.red); JOptionPane.showMessageDialog(null, areaException, "Error Syntax", JOptionPane.WARNING_MESSAGE); excepCatch = true; }*/ if (!excepCatch) { graph.addAttribute("ui.stylesheet", style); textPaneStyleGraph.setText(style); stylesheet = style; } } };
/** * Merge several graphs in one. A new graph is created, that will contain * the result. The method will try to create a graph of the same class that * the first graph to merge (it needs to have a constructor with a String). * Else, a MultiGraph is used. * * @param graphs * graphs to merge * @return merge result */ public static Graph merge(Graph... graphs) { if (graphs == null) return new DefaultGraph("void-merge"); String id = "merge"; for (Graph g : graphs) id += "-" + g.getId(); Graph result; try { Class<? extends Graph> cls = graphs[0].getClass(); result = cls.getConstructor(String.class).newInstance(id); } catch (Exception e) { logger.warning(String.format("Cannot create a graph of %s.", graphs[0].getClass().getName())); result = new MultiGraph(id); } mergeIn(result, graphs); return result; }
void displayGraph(fr.inria.corese.core.Graph g, NSManager nsm) { graph = create(g, nsm); graph.addAttribute("ui.stylesheet", stylesheet); graph.addAttribute("ui.antialias"); textPaneStyleGraph.setText(stylesheet);
public AlgorithmEventsRecorder(VehicleRoutingProblem vrp, String dgsFileLocation) { this.vrp = vrp; graph = new MultiGraph("g"); try { File dgsFile = new File(dgsFileLocation); fos = new FileOutputStream(dgsFile); fileSink = new FileSinkDGS(); if (dgsFile.getName().endsWith("gz")) { gzipOs = new GZIPOutputStream(fos); fileSink.begin(gzipOs); } else { fileSink.begin(fos); } graph.addSink(fileSink); } catch (IOException e) { e.printStackTrace(); } initialiseGraph(vrp); }
void displayGraph(fr.inria.edelweiss.kgraph.core.Graph g, NSManager nsm) { graph = create(g, nsm); graph.addAttribute("ui.stylesheet", stylesheet); graph.addAttribute("ui.antialias"); textPaneStyleGraph.setText(stylesheet);
public static Graph createMultiGraph(String name, String style) { Graph g = new MultiGraph(name); g.addAttribute("ui.quality"); g.addAttribute("ui.antialias"); g.addAttribute("ui.stylesheet", style); return g; }
Graph graph = new MultiGraph("graph");