| 1 |
<html> |
| 2 |
<head> |
| 3 |
<title> Tcl Dot API (tcldot)</title> |
| 4 |
<link rev=made href="mailto:[email protected]"> |
| 5 |
</head> |
| 6 |
<body> |
| 7 |
<h1> Tcl Dot API (tcldot)</h1> |
| 8 |
<p>(Tcl Dot also pulls in Gdtclft for writing to a gif image.) |
| 9 |
<p><hr> |
| 10 |
Create a new graph. |
| 11 |
<pre> |
| 12 |
<b>dotnew</b> <i>graphtype</i> ?<i>attributeName attributeValue</i>? ?...? |
| 13 |
-> <i>graphHandle</i> |
| 14 |
|
| 15 |
<i>graphtype</i>:= (<b>graph</b>|<b>digraph</b>|<b>graphstrict</b>|<b>digraphstrict</b>) |
| 16 |
</pre> |
| 17 |
Read a graph. |
| 18 |
<pre> |
| 19 |
<b>dotread</b> <i>fileHandle</i> |
| 20 |
-> <i>graphHandle</i> |
| 21 |
</pre> |
| 22 |
Add a node to a graph |
| 23 |
<pre> |
| 24 |
<i>graphHandle</i> <b>addnode</b> ?<i>nodeName</i>? ?<i>attributeName attributeValue</i>? ?...? |
| 25 |
-> <i>nodeHandle</i> |
| 26 |
|
| 27 |
If the <i>nodeName</i> parameter is omitted the name of the |
| 28 |
node defaults to <i>nodeHandle</i>. |
| 29 |
</pre> |
| 30 |
Add an edge to a graph |
| 31 |
<pre> |
| 32 |
<i>graphHandle</i> <b>addedge</b> <i>tailnode</i> <i>headnode</i> ?<i>attributeName attributeValue</i>? ?...? |
| 33 |
-> <i>edgeHandle</i> |
| 34 |
|
| 35 |
<i>tailnode</i> = (<i>tailnodeHandle</i>|<i>tailnodeName</i>) |
| 36 |
<i>headnode</i> = (<i>headnodeHandle</i>|<i>headnodeName</i>) |
| 37 |
|
| 38 |
NodeHandles take precedence, so if nodeName is of the form |
| 39 |
"node99" it may conflict. The precedence can be overridden |
| 40 |
with code such as: |
| 41 |
<i>graphHandle</i> <b>addedge</b> <b>\</b> |
| 42 |
<b>[</b><i>graphHandle</i> <b>findnode</b> <i>tailnodeName</i><b>]</b> <b>\</b> |
| 43 |
<b>[</b><i>graphHandle</i> <b>findnode</b> <i>headnodeName</i><b>]</b> |
| 44 |
</pre> |
| 45 |
Add a subgraph to a graph |
| 46 |
<pre> |
| 47 |
<i>graphHandle</i> <b>addsubgraph</b> ?<i>subgName</i>? ?<i>attributeName attributeValue</i>? ?...? |
| 48 |
-> <i>subgHandle</i> |
| 49 |
|
| 50 |
If the <i>subgName</i> parameter is omitted the name of the |
| 51 |
node defaults to <i>subgHandle</i>. |
| 52 |
|
| 53 |
Clusters are created by giving a subgraph a name that begins |
| 54 |
with "cluster". |
| 55 |
</pre> |
| 56 |
Add a edge to a node |
| 57 |
<pre> |
| 58 |
<i>tailnodeHandle</i> <b>addedge</b> <i>headnode</i> ?<i>attributeName attributeValue</i>? ?...? |
| 59 |
-> <i>edgeHandle</i> |
| 60 |
|
| 61 |
<i>headnode</i> = (<i>headnodeHandle</i>|<i>headnodeName</i>) |
| 62 |
</pre> |
| 63 |
Delete a graph/node/edge |
| 64 |
<pre> |
| 65 |
<i>graphHandle</i> <b>delete</b> |
| 66 |
<i>nodeHandle</i> <b>delete</b> |
| 67 |
<i>edgeHandle</i> <b>delete</b> |
| 68 |
</pre> |
| 69 |
Count nodes/edges |
| 70 |
<pre> |
| 71 |
<i>graphHandle</i> <b>countnodes</b> |
| 72 |
-> <i>integer</i> |
| 73 |
<i>graphHandle</i> <b>countedges</b> |
| 74 |
-> <i>integer</i> |
| 75 |
</pre> |
| 76 |
List subgraphs/nodes/edges |
| 77 |
<pre> |
| 78 |
<i>graphHandle</i> <b>listnodes</b> |
| 79 |
-> <i>{nodeHandle ... }</i> |
| 80 |
|
| 81 |
<i>nodeHandle</i> <b>listedges</b> |
| 82 |
-> <i>{edgeHandle ... }</i> |
| 83 |
<i>nodeHandle</i> <b>listoutedges</b> |
| 84 |
-> <i>{edgeHandle ... }</i> |
| 85 |
<i>nodeHandle</i> <b>listinedges</b> |
| 86 |
-> <i>{edgeHandle ... }</i> |
| 87 |
|
| 88 |
<i>edgeHandle</i> <b>listnodes</b> |
| 89 |
-> <i>tailnodeHandle</i> <i>headnodeHandle</i> |
| 90 |
|
| 91 |
<i>graphHandle</i> <b>listsubgraphs</b> |
| 92 |
-> <i>{graphHandle ... }</i> |
| 93 |
</pre> |
| 94 |
Find nodes/edges by nodename |
| 95 |
<pre> |
| 96 |
<i>graphHandle</i> <b>findnode</b> <i>nodename</i> |
| 97 |
-> <i>nodeHandle</i> |
| 98 |
|
| 99 |
<i>graphHandle</i> <b>findedge</b> <i>tailnodename</i> <i>headnodename</i> |
| 100 |
-> <i>edgeHandle</i> |
| 101 |
|
| 102 |
<i>nodeHandle</i> <b>findedge</b> <i>nodename</i> |
| 103 |
-> <i>edgeHandle</i> |
| 104 |
</pre> |
| 105 |
Show graph/node/edge name |
| 106 |
<pre> |
| 107 |
<i>graphHandle</i> <b>showname</b> |
| 108 |
-> <i>graphname</i> |
| 109 |
|
| 110 |
<i>nodeHandle</i> <b>showname</b> |
| 111 |
-> <i>nodename</i> |
| 112 |
|
| 113 |
<i>edgeHandle</i> <b>showname</b> |
| 114 |
-> <i>edgename</i> |
| 115 |
</pre> |
| 116 |
Set default node/edge attributes |
| 117 |
<pre> |
| 118 |
<i>graphHandle</i> <b>setnodeattributes</b> <i>attributeName attributeValue</i> ?...? |
| 119 |
<i>graphHandle</i> <b>setedgeattributes</b> <i>attributeName attributeValue</i> ?...? |
| 120 |
</pre> |
| 121 |
List node/edge attribute names |
| 122 |
<pre> |
| 123 |
<i>graphHandle</i> <b>listnodeattributes</b> |
| 124 |
-> <i>{attributeName ... }</i> |
| 125 |
<i>graphHandle</i> <b>listedgeattributes</b> |
| 126 |
-> <i>{attributeName ... }</i> |
| 127 |
</pre> |
| 128 |
Query default node/edge attributes |
| 129 |
<pre> |
| 130 |
<i>graphHandle</i> <b>querynodeattributes</b> <i>attributeName</i> ?...? |
| 131 |
-> <i>{attributeValue ... }</i> |
| 132 |
<i>graphHandle</i> <b>queryedgeattributes</b> <i>attributeName</i> ?...? |
| 133 |
-> <i>{attributeValue ... }</i> |
| 134 |
</pre> |
| 135 |
Set graph/node/edge attributes |
| 136 |
<pre> |
| 137 |
<i>graphHandle</i> <b>setattributes</b> <I>attributeName attributeValue</i> ?...? |
| 138 |
<i>nodeHandle</i> <b>setattributes</b> <i>attributeName attributeValue</i> ?...? |
| 139 |
<i>edgeHandle</i> <b>setattributes</b> <i>attributeName attributeValue</i> ?...? |
| 140 |
</pre> |
| 141 |
List graph/node/edge attribute names |
| 142 |
<pre> |
| 143 |
<i>graphHandle</i> <b>listattributes</b> |
| 144 |
-> <i>{attributeName ... }</i> |
| 145 |
<i>nodeHandle</i> <b>listattributes</b> |
| 146 |
-> <i>{attributeName ... }</i> |
| 147 |
<i>edgeHandle</i> <b>listattributes</b> |
| 148 |
-> <i>{attributeName ... }</i> |
| 149 |
</pre> |
| 150 |
Query graph/node/edge attribute values |
| 151 |
<pre> |
| 152 |
<i>graphHandle</i> <b>queryattributes</b> <i>attributeName</i> ?<i>attributeName</i>? ?...? |
| 153 |
-> <i>{attributeValue ... }</i> |
| 154 |
<i>nodeHandle</i> <b>queryattributes</b> <i>attributeName</i> ?<i>attributeName</i>? ?...? |
| 155 |
-> <i>{attributeValue ... }</i> |
| 156 |
<i>edgeHandle</i> <b>queryattributes</b> <i>attributeName</i> ?<i>attributeName</i>? ?...? |
| 157 |
-> <i>{attributeValue ... }</i> |
| 158 |
</pre> |
| 159 |
Layout nodes |
| 160 |
<pre> |
| 161 |
<i>graphHandle</i> <b>layoutNodes</b> |
| 162 |
|
| 163 |
<b>NOTE:</b> Not yet implemented. Use: |
| 164 |
<i>graphHandle</i> <b>layout</b> |
| 165 |
to layout both nodes and edges. |
| 166 |
</pre> |
| 167 |
Layout edges |
| 168 |
<pre> |
| 169 |
<i>graphHandle</i> <b>layoutEdges</b> -<i>style</i> |
| 170 |
|
| 171 |
<i>style</i>:= (<b>straight</b>|<b>spline</b>) |
| 172 |
|
| 173 |
<b>NOTE:</b> Not yet implemented. Use: |
| 174 |
<i>graphHandle</i> <b>layout</b> |
| 175 |
to layout both nodes and edges. |
| 176 |
</pre> |
| 177 |
Write graph to file |
| 178 |
<pre> |
| 179 |
<i>graphHandle</i> <b>write</b> <i>filehandle</i> <i>format</i> |
| 180 |
|
| 181 |
<i>format</i>:= (<b>ps</b>|<b>mif</b>|<b>gif</b>|<b>plain</b>|<b>dot</b>) |
| 182 |
</pre> |
| 183 |
Render graph to existing or new gifImage (see: |
| 184 |
<a href=http://guraldi.hgp.med.umich.edu/gdtcl.html>gdTcl</a>) |
| 185 |
<pre> |
| 186 |
<i>graphHandle</i> <b>rendergd</b> ?<i>gdHandle</i>? |
| 187 |
-> <i>gdHandle</i> |
| 188 |
</pre> |
| 189 |
Render graph to canvas (tkdot only) |
| 190 |
<pre> |
| 191 |
<i>graphHandle</i> <b>render</b> <i>canvashandle</i> |
| 192 |
|
| 193 |
<b>NOTE:</b> Not yet fully implemented. For now use: |
| 194 |
<b>set c</b> <i>canvasHandle</i> |
| 195 |
<b>eval [</b><i>graphHandle</i> <b>render]</b> |
| 196 |
</pre> |
| 197 |
</body> |
| 198 |
</html> |