1 |
|
(* |
2 |
|
* Here are some graph layout annotations. |
3 |
|
* |
4 |
|
* -- Allen |
5 |
|
*) |
6 |
|
|
7 |
structure GraphLayout = |
structure GraphLayout = |
8 |
struct |
struct |
9 |
|
|
10 |
exception LABEL of string |
datatype format = |
11 |
exception COLOR of string |
LABEL of string |
12 |
exception NODE_COLOR of string |
| COLOR of string |
13 |
exception EDGE_COLOR of string |
| NODE_COLOR of string |
14 |
exception TEXT_COLOR of string |
| EDGE_COLOR of string |
15 |
exception ARROW_COLOR of string |
| TEXT_COLOR of string |
16 |
exception BACKARROW_COLOR of string |
| ARROW_COLOR of string |
17 |
exception BORDER_COLOR of string |
| BACKARROW_COLOR of string |
18 |
exception BORDERLESS |
| BORDER_COLOR of string |
19 |
exception ALGORITHM of string |
| BORDERLESS |
20 |
exception EDGEPATTERN of string |
| SHAPE of string |
21 |
|
| ALGORITHM of string |
22 |
|
| EDGEPATTERN of string |
23 |
|
| DIR (* for internal use only! *) |
24 |
|
|
25 |
type annotations = Annotations.annotations |
val STYLE = Annotations.new(SOME(fn _ => "STYLE")) : |
26 |
|
format list Annotations.property |
27 |
|
|
28 |
type ('n,'e,'g) style = |
type ('n,'e,'g) style = |
29 |
{ edge : 'e Graph.edge -> annotations, |
{ edge : 'e Graph.edge -> format list, |
30 |
node : 'n Graph.node -> annotations, |
node : 'n Graph.node -> format list, |
31 |
graph : 'g -> annotations |
graph : 'g -> format list |
32 |
} |
} |
33 |
|
|
34 |
type layout = (annotations, annotations, annotations) Graph.graph |
type layout = (format list, format list, format list) Graph.graph |
35 |
|
|
36 |
fun makeLayout {node,edge,graph} G = |
fun makeLayout {node,edge,graph} G = |
37 |
IsomorphicGraphView.map node edge graph G |
IsomorphicGraphView.map node edge graph G |
38 |
|
|
39 |
|
fun makeLayout' G = |
40 |
|
let val edgeColor = [COLOR "red"] |
41 |
|
in makeLayout {node=fn (i,_) => [LABEL(Int.toString i)], |
42 |
|
edge=fn _ => edgeColor, |
43 |
|
graph=fn _ => []} G |
44 |
|
end |
45 |
|
|
46 |
end |
end |
47 |
|
|
|
(* |
|
|
* $Log$ |
|
|
*) |
|