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