Package yapgvb :: Class Node
[show private | hide private]
[frames | no frames]

Class Node


Nodes are created by calling Graph.add_node.

Edges can be created through the use of overloaded operators -, <<, and >>.
Property Summary
str color: Basic drawing color for graphics, not text.
str colorscheme: This attribute specifies a color scheme namespace.
str comment: Comments are inserted into output.
float distortion: Distortion factor for shape=polygon.
str fillcolor: Color used to fill the background of a node or cluster.
boolean fixedsize: If true, the node size is specified by the values of the width and height attributes only and is not expanded to contain the text label.
str fontcolor: Color used for text.
str fontname: Font used for text.
float fontsize: Font size, in points, used for text.
str group: If the end points of an edge belong to the same group, i.e., have the same group attribute, parameters are set to avoid crossings and keep the edges straight.
float height: Height of node, in inches.
str label: Text label attached to objects.
str layer: Specifies layers in which the node or edge is present.
float margin: For graphs, this sets x and y margins of canvas, in inches.
boolean nojustify: By default, the justification of multi-line labels is done within the largest context that makes sense.
float orientation: Angle, in degrees, used to rotate node shapes.
int peripheries: Set number of peripheries used in polygonal shapes and cluster boundaries.
boolean pin: If true and the node has a pos attribute on input, neato prevents the node from moving from the input position.
(x,y) or (x,y,z) tuple pos: Position of node, or spline control points, in points.
rect rects: Rectangles for fields of records, in points.
boolean regular: If true, force polygon to be regular.
boolean root: This specifies nodes to be used as the center of the layout and the root of the generated spanning tree.
string shape: Set the shape of a node.
str shapefile: If defined, shapefile specifies a file containing user-supplied node content.
int showboxes: Print guide boxes in PostScript at the beginning of routesplines if 1, or at the end if 2.
int sides: Number of sides if shape=polygon.
float skew: Skew factor for shape=polygon.
str style: Set style for node or edge.
str target: If the object has a URL, this attribute determines which window of the browser is used for the URL.
str tooltip: Tooltip annotation attached to the node or edge.
  URL: Hyperlinks incorporated into device-dependent output.
str vertices: If the input graph defines this attribute, the node is polynomial, and output is dot or xdot, this attribute provides the coordinates of the vertices of the node's polynomial, in inches.
float width: Width of node, in inches.
float z: Provides z coordinate value for 3D layouts and displays.
    Graph Definition
  __sub__: The syntax tail_node - head_node creates an undirected edge between two nodes.
  __lshift__: The syntax head_node << tail_node creates a directed edge between two nodes.
  __rshift__: The syntax tail_node >> head_node creates a directed edge between two nodes.
    Graph Traversal
  edges
  inbound_edges
  outbound_edges
  graph: The graph to which a Node belongs.

Property Details

__sub__

The syntax tail_node - head_node creates an undirected edge between two nodes. It is a convenient short syntax for tail_node.graph.add_edge(tail_node, head_node). An Edge object is returned. This should only be used for undirected graphs; use << and >> to create directed edges.

__lshift__

The syntax head_node << tail_node creates a directed edge between two nodes. It is a convenient short syntax for head_node.graph.add_edge(tail_node, head_node). An Edge object is returned. For undirected graphs, a << b is equivalent to a - b.

__rshift__

The syntax tail_node >> head_node creates a directed edge between two nodes. It is a convenient short syntax for tail_node.graph.add_edge(tail_node, head_node). An Edge object is returned. For undirected graphs, a >> b is equivalent to b - a.

graph

The graph to which a Node belongs.

color

Basic drawing color for graphics, not text. For the latter, use the fontcolor attribute.

For edges, the value can either be a single color or a colorList. In the latter case, the edge is drawn using parallel splines or lines, one for each color in the list, in the order given. The head arrow, if any, is drawn using the first color in the list, and the tail arrow, if any, the second color. This supports the common case of drawing opposing edges, but using parallel splines instead of separately routed multiedges. For example, the graph

digraph G { a -> b [dir=both color="red:blue"] }

yields

colorscheme

This attribute specifies a color scheme namespace. If defined, it specifies the context for interpreting color names. In particular, if a color value has form "xxx" or "//xxx", then the color xxx will be evaluated according to the current color scheme. If no color scheme is set, the standard X11 naming is used. For example, if colorscheme=bugn9, then color=7 is interpreted as "/bugn9/7".

comment

Comments are inserted into output. Device-dependent

distortion

Distortion factor for shape=polygon. Positive values cause top part to be larger than bottom; negative values do the opposite.

fillcolor

Color used to fill the background of a node or cluster. If fillcolor is not defined, color is used. (For clusters, if color is not defined, bgcolor is used.) If this is not defined, the default is used, except for shape=point or when the output format is MIF, which use black by default.

Note that a cluster inherits the root graph's attributes if defined. Thus, if the root graph has defined a fillcolor, this will override a color or bgcolor attribute set for the cluster.

fixedsize

If true, the node size is specified by the values of the width and height attributes only and is not expanded to contain the text label.

fontcolor

Color used for text.

fontname

Font used for text. This very much depends on the output format and, for non-bitmap output such as PostScript or SVG, the availability of the font when the graph is displayed or printed. As such, it is best to rely on font faces that are generally available, such as Times-Roman, Helvetica or Courier.

If Graphviz was built using the fontconfig library, the latter library will be used to search for the font. However, if the fontname string contains a slash character "/", it is treated as a pathname for the font file, though font lookup will append the usual font suffixes.

If Graphviz does not use fontconfig, fontname will be considered the name of a Type 1 or True Type font file. If you specify fontname=schlbk, the tool will look for a file named schlbk.ttf or schlbk.pfa or schlbk.pfb in one of the directories specified by the fontpath attribute. The lookup does support various aliases for the common fonts.

fontsize

Font size, in points, used for text.

group

If the end points of an edge belong to the same group, i.e., have the same group attribute, parameters are set to avoid crossings and keep the edges straight.

height

Height of node, in inches. This is taken as the initial, minimum height of the node. If fixedsize is true, this will be the final height of the node. Otherwise, if the node label requires more height to fit, the node's height will be increased to contain the label. Note also that, if the output format is dot, the value given to height will be the final value.

label

Text label attached to objects. If a node's shape is record, then the label can have a special format which describes the record layout.

layer

Specifies layers in which the node or edge is present.

margin

For graphs, this sets x and y margins of canvas, in inches. If the margin is a single double, both margins are set equal to the given value.

For nodes, this attribute specifies space left around the node's label. By default, the value is 0.11,0.055.

nojustify

By default, the justification of multi-line labels is done within the largest context that makes sense. Thus, in the label of a polygonal node, a left-justified line will align with the left side of the node (shifted by the prescribed margin). In record nodes, left-justified line will line up with the left side of the enclosing column of fields. If nojustify is "true", multi-line labels will be justified in the context of itself. For example, if the attribute is set, the first label line is long, and the second is shorter and left-justified, the second will align with the left-most character in the first line, regardless of how large the node might be.

orientation

Angle, in degrees, used to rotate node shapes.

peripheries

Set number of peripheries used in polygonal shapes and cluster boundaries. Note that user-defined shapes are treated as a form of box shape, so the default peripheries value is 1 and the user-defined shape will be drawn in a bounding rectangle. Setting peripheries=0 will turn this off. Also, 1 is the maximum peripheries value for clusters.

pin

If true and the node has a pos attribute on input, neato prevents the node from moving from the input position. This property can also be specified in the pos attribute itself (cf. the point type).

pos

Position of node, or spline control points, in points. In neato and fdp, pos can be used to set initial position of a node. Concerning this, see the -s command line flag.

rects

Rectangles for fields of records, in points.

description of rect type

regular

If true, force polygon to be regular.

root

This specifies nodes to be used as the center of the layout and the root of the generated spanning tree. As a graph attribute, this gives the name of the node. As a node attribute (circo only), it specifies that the node should be used as a central node. In twopi, this will actually be the central node. In circo, the block containing the node will be central in the drawing of its connected component. If not defined, twopi will pick a most central node, and circo will pick a random node.

shape

Set the shape of a node.

Possible values: 'box', 'polygon', 'ellipse', 'circle', 'point', 'egg', 'triangle', 'plaintext', 'diamond', 'trapezium', 'parallelogram', 'house', 'pentagon', 'hexagon', 'septagon', 'octagon', 'doublecircle', 'doubleoctagon', 'tripleoctagon', 'invtriangle', 'invtrapezium', 'invhouse', 'Mdiamond', 'Msquare', 'Mcircle', 'rect', 'rectangle', 'none', 'record', 'Mrecord'

shapefile

If defined, shapefile specifies a file containing user-supplied node content. The shape of the node is set to box. The image in the shapefile must be rectangular. The image formats supported as well as the precise semantics of how the file is used depends on the output format. For further details, see External PostScript files.

There is one exception to this usage. If shape is set to "epsf", shapefile gives a filename containing a definition of the node in PostScript. The graphics defined must be contain all of the node content, including any desired boundaries. For further details, see

External PostScript files.

showboxes

Print guide boxes in PostScript at the beginning of routesplines if 1, or at the end if 2. (Debugging)

sides

Number of sides if shape=polygon.

skew

Skew factor for shape=polygon. Positive values skew top of polygon to right; negative to left.

style

Set style for node or edge. For cluster subgraph, if "filled", the cluster box's background is filled.

target

If the object has a URL, this attribute determines which window of the browser is used for the URL. See W3C documentation.

tooltip

Tooltip annotation attached to the node or edge. If unset, Graphviz will use the object's label if defined. Note that if the label is a record specification or an HTML-like label, the resulting tooltip may be unhelpful. In this case, if tooltips will be generated, the user should set a tooltip attribute explicitly.

URL

Hyperlinks incorporated into device-dependent output. At present, used in ps2, cmap, i*map and svg formats. For all these formats, URLs can be attached to nodes, edges and clusters. URL attributes can also be attached to the root graph in ps2, cmap and i*map formats. This serves as the base URL for relative URLs in the former, and as the default image map file in the latter.

The active area for a node or cluster is its bounding box. For edges, the active areas are small circles where the edge contacts its head and tail nodes. These areas may overlap the related node, and the edge URL dominates. If the edge has a label, this will also be active. Finally, if the edge has a head or tail label, this will also be active. Note, however, that if the edge has a headURL attribute, it is this value that is used near the head node and on the head label, if defined. The similar restriction holds when tailURL is defined.

The URL of the root graph is only treated as an escString if the output format is cmap.

vertices

If the input graph defines this attribute, the node is polynomial, and output is dot or xdot, this attribute provides the coordinates of the vertices of the node's polynomial, in inches. If the node is an ellipse or circle, the samplepoints attribute affects the output.

width

Width of node, in inches. This is taken as the initial, minimum width of the node. If fixedsize is true, this will be the final width of the node. Otherwise, if the node label requires more width to fit, the node's width will be increased to contain the label. Note also that, if the output format is dot, the value given to width will be the final value.

z

Provides z coordinate value for 3D layouts and displays. If the graph has dim set to 3 (or more), neato will use a node's z value for the z coordinate of its initial position if its pos attribute is also defined.

Even if no z values are specified in the input, it is necessary to declare a z attribute for nodes, e.g, using node[z=""] in order to get z values on output. Thus, setting dim=3 but not declaring z will cause neato -Tvrml to layout the graph in 3D but project the layout onto the xy-plane for the rendering. If the z attribute is declared, the final rendering will be in 3D.

Attribute Type Descriptions The following list gives the legal strings corresponding to values of the given types.

Generated by Epydoc 2.1 on Tue Feb 21 14:34:48 2006 http://epydoc.sf.net