// Copyright 2003, Trustees of Indiana University // Please see the license in the file ../LICENSE import java.lang.*; public class johnson_test { public static void main(String[] args) { adjacency_list g = new adjacency_list(); hash_property_map pred_map = new hash_property_map(); hash_property_map distance_map = new hash_property_map(); hash_property_map,Double> weight_map = new hash_property_map,Double>(); hash_property_map,Double> new_weight_map = new hash_property_map,Double>(); hash_property_map> distance_matrix = new hash_property_map>(); g.add_vertex(new Integer(3)); distance_matrix.set(new Integer(3), new hash_property_map()); distance_map.set(new Integer(3), new Double(0)); g.add_vertex(new Integer(4)); distance_matrix.set(new Integer(4), new hash_property_map()); distance_map.set(new Integer(4), new Double(Double.POSITIVE_INFINITY)); g.add_vertex(new Integer(5)); distance_matrix.set(new Integer(5), new hash_property_map()); distance_map.set(new Integer(5), new Double(Double.POSITIVE_INFINITY)); g.add_vertex(new Integer(6)); distance_matrix.set(new Integer(6), new hash_property_map()); distance_map.set(new Integer(6), new Double(Double.POSITIVE_INFINITY)); g.add_edge(new Integer(3), new Integer(6)); weight_map.set(new adj_list_edge(new Integer(3), new Integer(6)), new Double(5)); g.add_edge(new Integer(3), new Integer(5)); weight_map.set(new adj_list_edge(new Integer(3), new Integer(5)), new Double(8)); g.add_edge(new Integer(4), new Integer(5)); weight_map.set(new adj_list_edge(new Integer(4), new Integer(5)), new Double(-1)); g.add_edge(new Integer(6), new Integer(4)); weight_map.set(new adj_list_edge(new Integer(6), new Integer(4)), new Double(-2)); g.add_edge(new Integer(4), new Integer(3)); weight_map.set(new adj_list_edge(new Integer(4), new Integer(3)), new Double(3)); johnson_all_pairs_shortest_paths.johnson_all_pairs_shortest_paths( g, weight_map, new_weight_map, distance_map, distance_matrix, new Double(0), new Double(Double.POSITIVE_INFINITY), new BinaryFunction() {public Double op(Double a, Double b) {return new Double((a.doubleValue() + b.doubleValue()));}}, new UnaryFunction() {public Double op(Double a) {return new Double((-a.doubleValue()));}}, new StrictWeakOrdering() {public boolean less(Double a, Double b) {return a.doubleValue(),Integer>)(g)); } }