Tcl Dot API (tcldot)

(Tcl Dot also pulls in Gdtclft for writing to a gif image.)


Create a new graph.
        dotnew graphtype ?attributeName attributeValue? ?...?
          -> graphHandle

	graphtype:= (graph|digraph|graphstrict|digraphstrict)
Read a graph.
        dotread fileHandle
          -> graphHandle
Add a node to a graph
        graphHandle addnode ?nodeName? ?attributeName attributeValue? ?...?
          -> nodeHandle

	If the nodeName parameter is omitted the name of the
	node defaults to nodeHandle.
Add an edge to a graph
        graphHandle addedge tailnode headnode ?attributeName attributeValue? ?...?
          -> edgeHandle

        tailnode = (tailnodeHandle|tailnodeName)
        headnode = (headnodeHandle|headnodeName)

        NodeHandles take precedence, so if nodeName is of the form
        "node99" it may conflict.  The precedence can be overridden
        with code such as:
            graphHandle addedge \
                   [graphHandle findnode tailnodeName] \
                   [graphHandle findnode headnodeName] 
Add a subgraph to a graph
        graphHandle addsubgraph ?subgName? ?attributeName attributeValue? ?...?
          -> subgHandle

	If the subgName parameter is omitted the name of the
	node defaults to subgHandle.

	Clusters are created by giving a subgraph a name that begins
	with "cluster".
Add a edge to a node
        tailnodeHandle addedge headnode ?attributeName attributeValue? ?...?
          -> edgeHandle

        headnode = (headnodeHandle|headnodeName)
Delete a graph/node/edge
        graphHandle delete
        nodeHandle delete
        edgeHandle delete
Count nodes/edges
        graphHandle countnodes
	  -> integer
        graphHandle countedges
	  -> integer
List subgraphs/nodes/edges
        graphHandle listnodes
	  -> {nodeHandle ... }

        nodeHandle listedges
	  -> {edgeHandle ... }
        nodeHandle listoutedges
	  -> {edgeHandle ... }
        nodeHandle listinedges
	  -> {edgeHandle ... }

        edgeHandle listnodes
	  -> tailnodeHandle headnodeHandle

        graphHandle listsubgraphs
	  -> {graphHandle ... }
Find nodes/edges by nodename
        graphHandle findnode nodename
	  -> nodeHandle

        graphHandle findedge tailnodename headnodename
	  -> edgeHandle

        nodeHandle findedge nodename
	  -> edgeHandle
Show graph/node/edge name
        graphHandle showname
	  -> graphname

        nodeHandle showname
	  -> nodename

        edgeHandle showname
	  -> edgename
Set default node/edge attributes
        graphHandle setnodeattributes attributeName attributeValue ?...?
        graphHandle setedgeattributes attributeName attributeValue ?...?
List node/edge attribute names
        graphHandle listnodeattributes
	  -> {attributeName ... }
        graphHandle listedgeattributes
	  -> {attributeName ... }
Query default node/edge attributes
        graphHandle querynodeattributes attributeName ?...?
	  -> {attributeValue ... }
        graphHandle queryedgeattributes attributeName ?...?
	  -> {attributeValue ... }
Set graph/node/edge attributes
        graphHandle setattributes attributeName attributeValue ?...?
        nodeHandle setattributes attributeName attributeValue ?...?
        edgeHandle setattributes attributeName attributeValue ?...?
List graph/node/edge attribute names
        graphHandle listattributes
	  -> {attributeName ... }
        nodeHandle listattributes
	  -> {attributeName ... }
        edgeHandle listattributes
	  -> {attributeName ... }
Query graph/node/edge attribute values
        graphHandle queryattributes attributeName ?attributeName? ?...?
	  -> {attributeValue ... }
        nodeHandle queryattributes attributeName ?attributeName? ?...?
	  -> {attributeValue ... }
        edgeHandle queryattributes attributeName ?attributeName? ?...?
	  -> {attributeValue ... }
Layout nodes
        graphHandle layoutNodes

	NOTE: Not yet implemented.  Use:
	      graphHandle layout
        to layout both nodes and edges.
Layout edges
        graphHandle layoutEdges -style

	style:= (straight|spline)

	NOTE: Not yet implemented.  Use:
	      graphHandle layout
        to layout both nodes and edges.
Write graph to file
        graphHandle write filehandle format

	format:= (ps|mif|gif|plain|dot)
Render graph to existing or new gifImage (see: gdTcl)
        graphHandle rendergd ?gdHandle?
          -> gdHandle
Render graph to canvas (tkdot only)
        graphHandle render canvashandle

	NOTE: Not yet fully implemented.  For now use:
	      set c canvasHandle
	      eval [graphHandle render]