(* * bellman_ford_test.sml - Test out the Bellman-Ford algorithm * Ronald Garcia * $Id: bellman_ford_test.sml,v 1.2 2003/05/02 20:03:36 jewillco Exp $ *) (* Copyright 2003, Trustees of Indiana University * Please see the license in the file ../LICENSE *) use "bellman_ford.sml"; use "graph242.sml"; structure BellF = MakeBellmanF(struct structure EdgeListGraph = ALGraph structure PredecessorMap = NumberMap structure DistanceMap = NumberMap structure WeightMap = EdgeMap structure VertexIndexMap = IndexMap structure ColorMap = ALGColorMap structure Compare = NCompare structure Combine = NCombine end); (* Dijkstra's does the following internally, Bellman-Ford does not. *) app (fn n => (NumberMap.put pmap n n; NumberMap.put dmap n 99999)) (ALGraph.vertices(g)); NumberMap.put dmap (hd (ALGraph.vertices(g))) 0; BellF.bellman_ford_shortest_paths g (ALGraph.num_vertices(g)) pmap dmap wmap (IndexMap.create()) (NCompare.create()) (NCombine.create());