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 /sml/trunk/src/MLRISC/scheduling/test1.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/scheduling/test1.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 695 - (view) (download)

1 : leunga 695 (*
2 :     * This is the example I used in the PACT '98 paper
3 :     *)
4 :     structure Test1 =
5 :     struct
6 :    
7 :     structure G = DirectedGraph
8 :    
9 :     fun makeDag nodes edges =
10 :     let val dag as Graph.GRAPH G = G.graph("Test1",(),10)
11 :     in app (fn n => #add_node G (n,n)) nodes;
12 :     app (#add_edge G) edges;
13 :     dag
14 :     end
15 :    
16 :     val dag = makeDag [1,2,3,4,5,6,7,8]
17 :     [(1,2,0),
18 :     (1,4,0),
19 :     (2,3,0),
20 :     (2,5,0),
21 :     (4,3,1),
22 :     (4,5,1),
23 :     (3,6,1),
24 :     (7,6,0)
25 :     ]
26 :    
27 :     fun close dag =
28 :     TransitiveClosure.acyclic_transitive_closure2
29 :     {+ = fn(i,j) => i+j+1,
30 :     max = Int.max
31 :     } dag
32 :    
33 :     fun palemSimons (dag as Graph.GRAPH G) =
34 :     let val dag' as Graph.GRAPH G' = G.graph("Tmp",(),10)
35 :     val _ = #forall_nodes G (#add_node G')
36 :     val _ = #forall_edges G (#add_edge G')
37 :     in PalemSimons.rank{dag = dag',
38 :     l = fn(_,_,l) => l,
39 :     d = fn _ => 10,
40 :     m = 1
41 :     }
42 :     end
43 :    
44 :     structure View = GraphViewerFn(daVinci)
45 :     structure L = GraphLayout
46 :    
47 :     fun view dag =
48 :     View.view(
49 :     L.makeLayout{node=fn(n,_)=>[L.LABEL(Int.toString n)],
50 :     edge=fn(i,j,l)=>[L.LABEL(Int.toString l),L.COLOR "red"],
51 :     graph=fn _ =>[]} dag
52 :     )
53 :    
54 :     end

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