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); }
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; }
/** * 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; }
/** * 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 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); }
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");
String objet; MultiGraph graph = new MultiGraph(g.getName(), false, true);
String objet; MultiGraph graph = new MultiGraph(g.getName(), false, true);