| 1 |
(* |
| 2 |
* Here are some graph layout annotations. |
| 3 |
* |
| 4 |
* -- Allen |
| 5 |
*) |
| 6 |
|
| 7 |
structure GraphLayout = |
| 8 |
struct |
| 9 |
|
| 10 |
datatype format = |
| 11 |
LABEL of string |
| 12 |
| COLOR of string |
| 13 |
| NODE_COLOR of string |
| 14 |
| EDGE_COLOR of string |
| 15 |
| TEXT_COLOR of string |
| 16 |
| ARROW_COLOR of string |
| 17 |
| BACKARROW_COLOR of string |
| 18 |
| BORDER_COLOR of string |
| 19 |
| BORDERLESS |
| 20 |
| SHAPE of string |
| 21 |
| ALGORITHM of string |
| 22 |
| EDGEPATTERN of string |
| 23 |
| DIR (* for internal use only! *) |
| 24 |
|
| 25 |
val STYLE = Annotations.new(SOME(fn _ => "STYLE")) : |
| 26 |
format list Annotations.property |
| 27 |
|
| 28 |
type ('n,'e,'g) style = |
| 29 |
{ edge : 'e Graph.edge -> format list, |
| 30 |
node : 'n Graph.node -> format list, |
| 31 |
graph : 'g -> format list |
| 32 |
} |
| 33 |
|
| 34 |
type layout = (format list, format list, format list) Graph.graph |
| 35 |
|
| 36 |
fun makeLayout {node,edge,graph} G = |
| 37 |
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 |
end |
| 46 |
|