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

# SCM Repository

[smlnj] Diff of /MLRISC/trunk/graphs/ugraph.sml
 [smlnj] / MLRISC / trunk / graphs / ugraph.sml

# Diff of /MLRISC/trunk/graphs/ugraph.sml

revision 411, Fri Sep 3 00:25:03 1999 UTC revision 429, Wed Sep 8 09:47:00 1999 UTC
# Line 15  Line 15
15  struct  struct
16
17     structure G = Graph     structure G = Graph
18     structure Sort = Sorting     structure Sort = ListMergeSort
19
20     fun undirected_view (G.GRAPH G) =     fun undirected_view (G.GRAPH G) =
22         let val in_edges  = map (fn (i,j,e) => (j,i,e)) (#in_edges G i)         let val in_edges  = map (fn (i,j,e) => (j,i,e)) (#in_edges G i)
23             val out_edges = #out_edges G i             val out_edges = #out_edges G i
24         in         in
25             Sort.sort_uniq (fn ((i,j,_),(i',j',_)) =>             Sort.uniqueSort (fn ((i,j,_),(i',j',_)) =>
26                                 i < i' orelse i = i' andalso j < j')                                if i < i' then LESS
27                            (fn ((i,j,_),(i',j',_)) => i = i' andalso j = j')                                else if i = i' then
28                                       if j < j' then LESS
29                                       else if j = j' then EQUAL
30                                       else GREATER
31                                  else GREATER)
32                            (in_edges @ out_edges)                            (in_edges @ out_edges)
33         end         end