1gv(3ocaml) gv(3ocaml)
2
3
4
6 gv_ocaml - graph manipulation in ocaml
7
8
12 gv_ocaml is a dynamically loaded extension for ocaml that provides ac‐
13 cess to the graph facilities of graphviz.
14
15
17 New graphs
18
19 New empty graph
20 graph_handle gv.graph (name);
21 graph_handle gv.digraph (name);
22 graph_handle gv.strictgraph (name);
23 graph_handle gv.strictdigraph (name);
24
25 New graph from a dot-syntax string or file
26 graph_handle gv.readstring (string);
27 graph_handle gv.read (string filename);
28 graph_handle gv.read (channel);
29
30 Add new subgraph to existing graph
31 graph_handle gv.graph (graph_handle, name);
32
33 New nodes
34
35 Add new node to existing graph
36 node_handle gv.node (graph_handle, name);
37
38 New edges
39
40 Add new edge between existing nodes
41 edge_handle gv.edge (tail_node_handle, head_node_handle);
42
43 Add a new edge between an existing tail node, and a named head node
44 which will be induced in the graph if it doesn't already exist
45 edge_handle gv.edge (tail_node_handle, head_name);
46
47 Add a new edge between an existing head node, and a named tail node
48 which will be induced in the graph if it doesn't already exist
49 edge_handle gv.edge (tail_name, head_node_handle);
50
51 Add a new edge between named tail and head nodes which will be induced
52 in the graph if they don't already exist
53 edge_handle gv.edge (graph_handle, tail_name, head_name);
54
55 Setting attribute values
56
57 Set value of named attribute of graph/node/edge - creating attribute if
58 necessary
59 string gv.setv (graph_handle, attr_name, attr_value);
60 string gv.setv (node_handle, attr_name, attr_value);
61 string gv.setv (edge_handle, attr_name, attr_value);
62
63 Set value of existing attribute of graph/node/edge (using attribute
64 handle)
65 string gv.setv (graph_handle, attr_handle, attr_value);
66 string gv.setv (node_handle, attr_handle, attr_value);
67 string gv.setv (edge_handle, attr_handle, attr_value);
68
69 Getting attribute values
70
71 Get value of named attribute of graph/node/edge
72 string gv.getv (graph_handle, attr_name);
73 string gv.getv (node_handle, attr_name);
74 string gv.getv (edge_handle, attr_name);
75
76 Get value of attribute of graph/node/edge (using attribute handle)
77 string gv.getv (graph_handle, attr_handle);
78 string gv.getv (node_handle, attr_handle);
79 string gv.getv (edge_handle, attr_handle);
80
81 Obtain names from handles
82 string gv.nameof (graph_handle);
83 string gv.nameof (node_handle);
84 string gv.nameof (attr_handle);
85
86 Find handles from names
87 graph_handle gv.findsubg (graph_handle, name);
88 node_handle gv.findnode (graph_handle, name);
89 edge_handle gv.findedge (tail_node_handle, head_node_handle);
90 attribute_handle gv.findattr (graph_handle, name);
91 attribute_handle gv.findattr (node_handle, name);
92 attribute_handle gv.findattr (edge_handle, name);
93
94 Misc graph navigators returning handles
95 node_handle gv.headof (edge_handle);
96 node_handle gv.tailof (edge_handle);
97 graph_handle gv.graphof (graph_handle);
98 graph_handle gv.graphof (edge_handle);
99 graph_handle gv.graphof (node_handle);
100 graph_handle gv.rootof (graph_handle);
101
102 Obtain handles of proto node/edge for setting default attribute values
103 node_handle gv.protonode (graph_handle);
104 edge_handle gv.protoedge (graph_handle);
105
106 Iterators
107
108 Iteration termination tests
109 bool gv.ok (graph_handle);
110 bool gv.ok (node_handle);
111 bool gv.ok (edge_handle);
112 bool gv.ok (attr_handle);
113
114 Iterate over subgraphs of a graph
115 graph_handle gv.firstsubg (graph_handle);
116 graph_handle gv.nextsubg (graph_handle, subgraph_handle);
117
118 Iterate over supergraphs of a graph (obscure and rarely useful)
119 graph_handle gv.firstsupg (graph_handle);
120 graph_handle gv.nextsupg (graph_handle, subgraph_handle);
121
122 Iterate over edges of a graph
123 edge_handle gv.firstedge (graph_handle);
124 edge_handle gv.nextedge (graph_handle, edge_handle);
125
126 Iterate over outedges of a graph
127 edge_handle gv.firstout (graph_handle);
128 edge_handle gv.nextout (graph_handle, edge_handle);
129
130 Iterate over edges of a node
131 edge_handle gv.firstedge (node_handle);
132 edge_handle gv.nextedge (node_handle, edge_handle);
133
134 Iterate over out-edges of a node
135 edge_handle gv.firstout (node_handle);
136 edge_handle gv.nextout (node_handle, edge_handle);
137
138 Iterate over head nodes reachable from out-edges of a node
139 node_handle gv.firsthead (node_handle);
140 node_handle gv.nexthead (node_handle, head_node_handle);
141
142 Iterate over in-edges of a graph
143 edge_handle gv.firstin (graph_handle);
144 edge_handle gv.nextin (node_handle, edge_handle);
145
146 Iterate over in-edges of a node
147 edge_handle gv.firstin (node_handle);
148 edge_handle gv.nextin (graph_handle, edge_handle);
149
150 Iterate over tail nodes reachable from in-edges of a node
151 node_handle gv.firsttail (node_handle);
152 node_handle gv.nexttail (node_handle, tail_node_handle);
153
154 Iterate over nodes of a graph
155 node_handle gv.firstnode (graph_handle);
156 node_handle gv.nextnode (graph_handle, node_handle);
157
158 Iterate over nodes of an edge
159 node_handle gv.firstnode (edge_handle);
160 node_handle gv.nextnode (edge_handle, node_handle);
161
162 Iterate over attributes of a graph
163 attribute_handle gv.firstattr (graph_handle);
164 attribute_handle gv.nextattr (graph_handle, attr_handle);
165
166 Iterate over attributes of an edge
167 attribute_handle gv.firstattr (edge_handle);
168 attribute_handle gv.nextattr (edge_handle, attr_handle);
169
170 Iterate over attributes of a node
171 attribute_handle gv.firstattr (node_handle);
172 attribute_handle gv.nextattr (node_handle, attr_handle);
173
174 Remove graph objects
175 bool gv.rm (graph_handle);
176 bool gv.rm (node_handle);
177 bool gv.rm (edge_handle);
178
179 Layout
180
181 Annotate a graph with layout attributes and values using a specific
182 layout engine
183 bool gv.layout (graph_handle, string engine);
184
185 Render
186
187 Render a layout into attributes of the graph
188 bool gv.render (graph_handle);
189
190 Render a layout to stdout
191 bool gv.render (graph_handle, string format);
192
193 Render to an open file
194 bool gv.render (graph_handle, string format, channel fout);
195
196 Render a layout to an unopened file by name
197 bool gv.render (graph_handle, string format, string filename);
198
199 Render to a string result
200 string gv.renderresult (graph_handle ing, string format);
201 gv.renderresult (graph_handle, string format, string outdata);
202
203 Render to an open channel
204 bool gv.renderchannel (graph_handle, string format, string chan‐
205 nelname);
206
207 Render a layout to a malloc'ed string, to be free'd by the caller
208
209 (deprecated - too easy to leak memory)
210
211 (still needed for "eval [gv::renderdata $G tk]" )
212 string gv.renderdata (graph_handle, string format);
213
214 Writing graph back to file
215 bool gv.write (graph_handle, string filename);
216 bool gv.write (graph_handle, channel);
217
218 Graph transformation tools
219 bool gv.tred (graph_handle);
220
221
223 graph, dot, neato, fdp, circo, twopi, ocaml.
224
225
226
227
228 26 May 2021 gv(3ocaml)