-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdotfn.sml
61 lines (50 loc) · 1.9 KB
/
dotfn.sml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
(* $Id$
*
* Copyright (c) 2008 Timothy Bourke (University of NSW and NICTA)
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the "BSD License" which is distributed with the
* software in the file LICENSE.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the BSD
* License for more details.
*
* Basic implementation of DOT files.
*)
functor DotFn (
structure Id : ID
structure EdgeAtt : ATTRIBUTE
structure NodeAtt : ATTRIBUTE
structure GraphAtt : ATTRIBUTE
) : DOT
=
struct
structure EdgeAtt = EdgeAtt
and NodeAtt = NodeAtt
and GraphAtt = GraphAtt
and Id = Id
datatype compassPt = N | NE | E | SE | S | SW | W | NW
datatype anchor = NodeId of Id.t
| SubgraphId of Id.t
| PortId of Id.t * Id.t * compassPt option
datatype node = Node of {id: Id.t,
atts: NodeAtt.t list}
datatype edge = Edge of {src: anchor,
dst: anchor,
atts: EdgeAtt.t list}
| Path of {stops: anchor list,
atts: EdgeAtt.t list}
datatype subgraph = Subgraph of {name: Id.t option,
attributes: GraphAtt.t list,
nodeAtts: NodeAtt.t list,
edgeAtts: EdgeAtt.t list,
nodes: node list,
subgraphs: subgraph list,
edges: edge list}
datatype graph = Graph of {strict: bool,
directed: bool,
graph: subgraph}
end