AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
dotGraphToYDAT (Object graph[, String delim[, Object attr[, int terminate[, int referenced]]]) yoix.graph
 
Returns a String representation of graph in a format suitable for the Yoix YDAT module. The graph argument can be a String or a Element. When the graph argument is a String, it should be in the DOT graph description format, which is described at http://www.research.att.com/sw/tool/graphviz/. Whether as a String or a Element, the graph description should contain element attributes of the type generated by the xdot output format of the graphviz layout engines. In addition, the -y option should be used in layout generation so that the y-axis information is flipped to correspond to screen coordinate orientation.

If supplied, the first character of delim is used to delimit partitions, if any. The default delimiter is a vertical-bar (|). The attr argument can be an Array or a Dictionary. If supplied, attr provides a list of attribute names that are to be extracted from graph and included in the output generated for YDAT. The list can either be supplied generally by means of an Array, or a Dictionary can be used to associate an Array of attribute names with a specific partition. Partition information is associated with graph elemennts using either a _partition_ attribute to the graph elements or based on the type of the element (GRAPH_NODE or GRAPH_EDGE). If supplied, terminate indicates that each line of output for YDAT should be terminate by a delim prior to the new-line. The default is FALSE. If supplied, referenced indicates the actual layout information should be kept separate from the graph element descriptions in the generated output for YDAT. The description will reference the layout they need. In this way, multiple graph elements that share the same layout information do not require repeated renderings of the same layout making for more efficient graph presentation. In addition, this format keeps duplicate layout elements from being silently removed. The default is FALSE.
 
 Example:   The following script loads a graph in DOT format from a string and writes the YDAT format to standard output.
import yoix.graph.*;

graph_str = @<<
digraph g {
 node [label="\N", shape=ellipse];
 graph [bb="0,0,106,180",
  xdotversion="1.1",
  _draw_="C 5 -white c 5 -white P 4 -2 182 -2 178 2 178 2 182 "];
 n1 [label="DOT Input", pos="53,18", width="1.22", height="0.50",
  _draw_="c 5 -black e 53 18 44 18 ",
  _ldraw_="c 5 -black F 14.000000 11 -Times-Roman T 53 23 0 63 9 -DOT Input "];
 n2 [label="Yoix Script", shape=box, pos="53,90", width="1.11", height="0.50",
  _draw_="c 5 -black p 4 93 72 13 72 13 108 93 108 ",
  _ldraw_="c 5 -black F 14.000000 11 -Times-Roman T 53 95 0 64 11 -Yoix Script "];
 n3 [label="YDAT Output", pos="53,162", width="1.47", height="0.50",
  _draw_="c 5 -black e 53 162 53 18 ",
  _ldraw_="c 5 -black F 14.000000 11 -Times-Roman T 53 167 0 80 11 -YDAT Output "];
 n1 -> n2 [pos="e,53,72 53,36 53,44 53,53 53,62",
  _draw_="c 5 -black C 5 -black B 4 53 36 53 44 53 53 53 62 ",
  _hdraw_="S 5 -solid S 15 -setlinewidth(1) P 3 57 62 53 72 50 62 "];
 n2 -> n3 [pos="e,53,144 53,108 53,116 53,125 53,134",
  _draw_="c 5 -black C 5 -black B 4 53 108 53 116 53 125 53 134 ",
  _hdraw_="S 5 -solid S 15 -setlinewidth(1) P 3 57 134 53 144 50 134 "];
}
>>@;

stdout.nextbuf = dotGraphToYDAT(graph_str);
The results on standard output would be similar to what is shown below except that these lines have been wrapped to fit more reasonably for reading.
n2--n1 2 w 0 c 5 -black C 5 -black B 4 53 36 53 44 53 53 53 62 w 1 S 5 -solid
       S 15 -setlinewidth(1) P 3 57 62 53 72 50 62 x 2 53 53|2
n3--n2 2 w 0 c 5 -black C 5 -black B 4 53 108 53 116 53 125 53 134 w 1 S 5 -solid
       S 15 -setlinewidth(1) P 3 57 134 53 144 50 134 x 2 53 125|2
n1 1 c 5 -black e 53 18 44 18 < c 5 -black F 14.000000 11 -Times-Roman
       T 53 23 0 63 9 -DOT Input > x 2 53 18|1
n2 1 c 5 -black p 4 93 72 13 72 13 108 93 108 < c 5 -black F 14.000000 11 -Times-Roman
       T 53 95 0 64 11 -Yoix Script > x 2 53 90|1
n3 1 c 5 -black e 53 162 53 18 < c 5 -black F 14.000000 11 -Times-Roman
       T 53 167 0 80 11 -YDAT Output > x 2 53 162|1
 
 Return:   String
 
 See Also:   countElements, dotGraph, Edge, Graph, listElements, Node

 

Yoix is a registered trademark of AT&T Inc.