// Copyright 2003, Trustees of Indiana University // Please see the license in the file ../LICENSE using GCollections; public class dijkstra_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>(); double inf = 1.0/0.0; g.add_vertex(3); distance_map[3] = 0; g.add_vertex(4); distance_map[4] = inf; g.add_vertex(5); distance_map[5] = inf; g.add_vertex(6); distance_map[6] = inf; g.add_edge(3, 6); weight_map[new adj_list_edge(3, 6)] = 5; g.add_edge(3, 5); weight_map[new adj_list_edge(3, 5)] = 8; g.add_edge(4, 5); weight_map[new adj_list_edge(4, 5)] = 1; g.add_edge(6, 4); weight_map[new adj_list_edge(6, 4)] = 2; g.add_edge(4, 3); weight_map[new adj_list_edge(4, 3)] = 3; dijkstra_shortest_paths.go< adjacency_list, int, adj_list_edge, IEnumerable, IEnumerable >, hash_property_map,double>, hash_property_map, double, hash_property_map, plus_double, less_double> (g, 3, pred_map, distance_map, weight_map, new less_double(), new plus_double(), inf, 0); for (int i = 3; i < 7; ++i) System.Console.WriteLine("dist[{0}] = {1}, pred[{0}] = {2}", i, distance_map[i], pred_map[i]); } }