Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /MLRISC/trunk/graphs/test3.sml
ViewVC logotype

Annotation of /MLRISC/trunk/graphs/test3.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2126 - (view) (download)

1 : leunga 714 CM.make "../cm/Graphs.cm";
2 : monnier 409 structure TestMinCut =
3 :     struct
4 :     val G as Graph.GRAPH g = DirectedGraph.graph("foo",(),10) :
5 :     (string,int,unit) Graph.graph
6 :     val _ = app (#add_node g)
7 :     [(0,"s"),
8 :     (1,"v1"),
9 :     (2,"v2"),
10 :     (3,"v3"),
11 :     (4,"v4"),
12 :     (5,"t")
13 :     ]
14 :     val E = [(0,1,16),
15 :     (0,2,13),
16 :     (1,2,10),
17 :     (2,1,4),
18 :     (1,3,12),
19 :     (2,4,14),
20 :     (*(3,2,9),*)
21 :     (4,3,7),
22 :     (3,5,20),
23 :     (4,5,4)
24 :     ]
25 :     val _ = app (#add_edge g) E
26 :     (* val _ = app (fn (i,j,w) => #add_edge g (j,i,w)) E *)
27 :    
28 : george 545 structure MinCut = MinCut(struct type elem = int
29 : monnier 409 open Int
30 :     val zero = 0
31 :     val == : int * int -> bool = op =
32 :     end)
33 :    
34 :     fun test() =
35 :     let fun weight(_,_,w) = w
36 :     val (cut,w) = MinCut.min_cut {graph=G,weight=weight}
37 :     in if w <> 23 then raise Match else ();
38 :     (cut,w)
39 :     end
40 :    
41 :     end

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0