(* * relax_test.sml * Ronald Garcia * $Id: relax_test.sml,v 1.2 2003/05/02 20:03:41 jewillco Exp $ *) (* Copyright 2003, Trustees of Indiana University * Please see the license in the file ../LICENSE *) use "relax.sml"; use "adj_list.sml"; use "utils.sml"; (* Graph with |V| = 5, |E| = 10 *) val g = ALGraph.create(5); (* See Figure 24.2 of CLR *) ALGraph.add_edge(g,0,1); ALGraph.add_edge(g,0,3); ALGraph.add_edge(g,1,3); ALGraph.add_edge(g,1,2); ALGraph.add_edge(g,2,4); ALGraph.add_edge(g,3,1); ALGraph.add_edge(g,3,2); ALGraph.add_edge(g,3,4); ALGraph.add_edge(g,4,0); ALGraph.add_edge(g,4,2); val wmap = EdgeMap.create(); EdgeMap.put wmap (0,1) 3; EdgeMap.put wmap (0,3) 5; EdgeMap.put wmap (1,3) 2; EdgeMap.put wmap (1,2) 6; EdgeMap.put wmap (2,4) 2; EdgeMap.put wmap (3,1) 1; EdgeMap.put wmap (3,2) 4; EdgeMap.put wmap (3,4) 6; EdgeMap.put wmap (4,0) 3; EdgeMap.put wmap (4,2) 7; val dmap = NumberMap.create(5); NumberMap.put dmap 0 0; NumberMap.put dmap 1 9999; NumberMap.put dmap 2 9999; NumberMap.put dmap 3 9999; NumberMap.put dmap 4 9999; val pmap = NumberMap.create(5); NumberMap.put pmap 0 0; NumberMap.put pmap 1 1; NumberMap.put pmap 2 2; NumberMap.put pmap 3 3; NumberMap.put pmap 4 4; structure Relax = MakeRelax(struct structure Graph = ALGraph structure WMap = EdgeMap structure DMap = NumberMap structure PMap = NumberMap structure Cmp = NCompare structure Cmb = NCombine end); Relax.go dmap wmap pmap (NCompare.create()) (NCombine.create()) g (0,1)