/** * */ @SuppressWarnings("unchecked") public MyGraphMLWriter() { vertex_ids = new Transformer<V,String>() { public String transform(V v) { return v.toString(); } }; edge_ids = TransformerUtils.nullTransformer(); graph_data = Collections.emptyMap(); vertex_data = Collections.emptyMap(); edge_data = Collections.emptyMap(); vertex_desc = TransformerUtils.nullTransformer(); edge_desc = TransformerUtils.nullTransformer(); graph_desc = TransformerUtils.nullTransformer(); nest_level = 0; }
/** * */ @SuppressWarnings("unchecked") public GraphMLWriter() { vertex_ids = new Transformer<V,String>() { public String transform(V v) { return v.toString(); } }; edge_ids = TransformerUtils.nullTransformer(); graph_data = Collections.emptyMap(); vertex_data = Collections.emptyMap(); edge_data = Collections.emptyMap(); vertex_desc = TransformerUtils.nullTransformer(); edge_desc = TransformerUtils.nullTransformer(); graph_desc = TransformerUtils.nullTransformer(); nest_level = 0; }
private Transformer<E,Double> inverseEdgeWeights() { Map<E,Double> ans = new HashMap<E,Double>(); for(E edge: this.nonZeroEdgeWeights.keySet()){ if(nonZeroEdgeWeights.get(edge).doubleValue() > CplexUtil.epsilon){ ans.put(edge, Math.max(1-nonZeroEdgeWeights.get(edge),0)); } } return TransformerUtils.switchTransformer(edgeIsNonZero, TransformerUtils.mapTransformer(ans), TransformerUtils.constantTransformer(Double.valueOf(1.0))); }
public APSPPreProcessor(KepInstance<V, E> kepInstance, Optional<FixedThreadPool> threadPool) { this.kepInstance = kepInstance; System.out.println("Starting all pairs shortest path"); long time = System.currentTimeMillis(); allPairsShortestPath = new ParallelFloydWarshallJung<V, E>( kepInstance.getGraph(), TransformerUtils.<Integer> constantTransformer(Integer .valueOf(1)), threadPool); allPairsShortestPath.solve(); long elapsed = System.currentTimeMillis() - time; System.out .println("Finished all pairs shortest path, elapsed time ms: " + elapsed); minDistToAnyRoot = Maps.newHashMap(); for (V vertex : kepInstance.getGraph().getVertices()) { if (kepInstance.getRootNodes().contains(vertex)) { minDistToAnyRoot.put(vertex, 0.0); } else { double bestDist = Double.POSITIVE_INFINITY; for (V root : kepInstance.getRootNodes()) { bestDist = Math.min(bestDist, allPairsShortestPath .getShortestPathLength(root, vertex)); } minDistToAnyRoot.put(vertex, bestDist); } } }
public Map makeEmptyMap() { return TransformedSortedMap.decorate(new TreeMap(), TransformerUtils.nopTransformer(), TransformerUtils.nopTransformer()); }
public Map makeEmptyMap() { return TransformedMap.decorate(new HashMap(), TransformerUtils.nopTransformer(), TransformerUtils.nopTransformer()); }