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/graphs/trace-graph.sml
ViewVC logotype

Annotation of /sml/trunk/src/MLRISC/graphs/trace-graph.sml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 412 - (view) (download)

1 : monnier 245 (*
2 : monnier 411 * Trace subgraph adaptor. This takes a linear list of node ids.
3 :     * The view returned is the part of the graph that lies on this linear list.
4 : monnier 245 *)
5 :    
6 :     signature TRACE_SUBGRAPH_VIEW =
7 :     sig
8 :    
9 :     val trace_view : Graph.node_id list ->
10 :     ('n,'e,'g) Graph.graph ->
11 :     ('n,'e,'g) Graph.graph
12 :     end
13 :    
14 :     structure TraceView : TRACE_SUBGRAPH_VIEW =
15 :     struct
16 :    
17 :     structure G = Graph
18 :     structure A = HashArray
19 :     structure S = Subgraph_P_View
20 :    
21 :     fun trace_view nodes (G as G.GRAPH g) =
22 :     let val ord = A.array(#capacity g (),~100)
23 :     fun order(i,[]) = ()
24 :     | order(i,n::ns) = (A.update(ord,n,i); order(i+1,ns))
25 :     val _ = order(0,nodes)
26 :     fun node_p i = A.sub(ord,i) >= 0
27 :     fun edge_p (i,j) = A.sub(ord,i) + 1 = A.sub(ord,j)
28 :     in S.subgraph_p_view nodes node_p edge_p G
29 :     end
30 :    
31 :     end
32 :    

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