next up previous contents index
Next: Geometry Windows ( GeoWin Up: Graphics Previous: Graph Windows ( GraphWin   Contents   Index

Subsections

The GraphWin (GW) File Format

The gw -format is the external graph format of GraphWin. It extends LEDA's graph format described in the previous section by additional parameters and attributes for describing graph drawings. Note that the gw -format was not defined to be a readable or easy to extend file format (in contrast to the GML format that is also supported by GraphWin).

Each gw file starts with a LEDA graph followed by a (possibly empty) layout section. An empty layout section indicates that no drawing of the graph is known, e.g. in the input file of a layout algorithm. If a layout section is given, it consists of three parts:

  1. global parameters
  2. node attributes
  3. edge attributes

Global Parameters


The global parameter section consists of 7 lines (with an arbitrary number of inter-mixed comment-lines).

  1. version line
    The version line specifies the version of of the gw-format. It consists of the string GraphWin followed by a floating-point number (1.32 for the current version of GraphWin).

  2. window parameters
    scaling wxmin wymin wxmax wymax
    This line consists of 5 floating-point numbers specifiying the scaling, minimal/maximal x- and y-coordinates of the window (see the window class of LEDA).

  3. node label font
    type size
    This line defines the font used for node labels. The type value of of type int . Possible values (see gw_font_type) are
    0 (roman_font)
    1 (bold_font)
    2 (italic_font)
    3 (fixed_font). The size value is of type int and defines the size of the font in points.

  4. edge label font
    type size as above, but defines the font used for edge labels.

  5. node index format
    format
    This line contains a printf-like format string used for constructing the index label of nodes (e.g. %d).

  6. edge index format
    format
    This line contains a printf-like format string used for constructing the index label of edges (e.g. %d).

  7. multi-edge distance
    dist
    This line contains a floating-point parameter dist that defines the distance used to draw parallel edges.

We close the description of the global parameter section with an example.

# version
GraphWin 1.32
# window parameters
1.0 -10.0 -5.0 499.0 517.0
# node font
0 12
# edge font
0 12
# node index string
%d
# edge index string
%d
# multi-edge distance
4.0

Node Attributes


The node attribute section contains for each node of the graph a line consisting of the following attributes (separated by blanks). More precisely, the i -th line in this section defines the attributes of the i -th node of the graph (see section leda-format).

x-coordinate
an attribute of type double defining the x-coordinate of the center of the node.

y-coordinate
an attribute of type double defining the y-coordinate of the center of the node.

shape
an attribute of type int defining the shape of the node. Possible values are (see gw_node_shape of GraphWin)
0 (circle_node)
1 (ellipse_node)
2 (square_node)
3 (rectangle_node.

border color
an attribute of type int defining the color used to draw the boundary line of the node. Possible values are (see the LEDA color type)
-1 (invisible )
0 (black )
1 (white )
2 (red )
3 (green )
4 (blue )
5 (yellow )
6 (violet )
7 (orange )
8 (cyan )
9 (brown )
10 (pink )
11 (green2 )
12 (blue2 )
13 (grey1 )
14 (grey2 )
15 (grey3 )
16 (ivory ).

border width
an attribute of type double defining the width of the border line of the node.

radius1
an attribute of type double defining the horizontal radius of the node

radius2
an attribute of type double defining the vertical radius of the node

color
an attribute of type int defining the color used to fill the interior of the node. See the LEDA color type for possible values.

label type
an attribute of type int specifying the label type. Possible values (see gw_label_type of GraphWin) are
0 (no_label)
1 (user_label)
2 (data_label)
3 (index_label).

label color
an attribute of type int defining the color used to draw the label of the node. See the LEDA color type for possible values.

label position
an attribute of type int defining the label position. Possible values (see gw_position of GraphWin) are
0 (central_pos)
1 (northwest_pos)
2 (north_pos)
3 (northeast_pos)
4 (east_pos)
5 (southeast_pos)
6 (south_pos)
7 (southwest_pos)
8 (west_pos).

user label
an attribute of type string defining the user label of the node.

We close this section with an example of a node attribute line that describes a circle node at position (189, 260) with border color black , border width 0.5 , horizontal and vertical radius 12 , interior color ivory , label type index$ \_label$ , label position east$ \_pos$ , and an empty user label.

# x   y     shape b-clr b-width radius1 radius2   clr l-type l-clr l-pos l-str
189.0 260.0 0     1     0.5     12.0    12.0      16  3      -1    4

Edge Attributes:


The edge attribute section contains for each edge of the graph a line consisting of the following attributes (separated by blanks). More precisely, the i -th line in this section defines the attributes of the i -th edge of the graph (see section leda-format).

width
an attribute of type double defining the width of the edge.

color
an attribute of type color defining the color of the edge.

shape
an attribute of type int defining the shape of the edge. Possible values (see gw_edge_shape of GraphWin) are
0 (poly_edge)
1 (circle_edge)
2 (bezier_edge)
3 (spline_edge).

style
an attribute of type int defining the line style of the edge. Possible values (see the LEDA line_style type) are
o (solid)
1 (dashed)
2 (dotted)
3 (dashed_dotted).

direction
an attribute of type int defining whether the edge is drawn as a directed or an undirected edge. Possible values (see gw_edge_dir of GraphWin) are
0 (undirected_edge)
1 (directed_edge)
2 (redirected_edge)
3 (bidirected_edge).

label type
an attribute of type int defining the label type of the edge. Possible values (see gw_label_type of GraphWin) are
0 (no_label)
1 (user_label)
2 (data_label)
3 (index_label).

label color
an attribute of type int defining the color of the edge label. See the LEDA color type for possible values.

label position
an attribute of type int defining the position of the label. Possible values (see gw_position of GraphWin) are
0 (central_pos)
4 (east_pos)
8 (west_pos blue ).

polyline
an attribute of type list < point > defining the polyline used to draw the edge. The list is represented by the number n of elements followed by n points (xi, yi) for i = 1...n . The first element of the list is the point where the edge leaves the interior of the source node, the last element is the point where the edge enters the interior of the target node. The remaining elements give the sequence of bends (or control points in case of a bezier or spline edge).

user label
an attribute of type string defining the user label of the edge.

We close this section with an example of an edge attribute line that describes a blue solid polygon edge of width 0.5 drawn directed from source to target, with a black user-defined label "my label" at position east$ \_pos$ , centered source and target anchors, and with a bend at position (250, 265) .

# width clr shape style dir ltype lclr lpos sanch tanch poly lstr
  0.5   4   0     0     1   1     1    4    (0,0) (0,0) 3 (202.0,262.0) (250.0,265.0) (328.0,274.0)  my label

A complete example

LEDA.GRAPH
void
void
5
|{}|
|{}|
|{}|
|{}|
|{}|
7
1 2 0 |{}|
1 3 0 |{}|
2 3 0 |{}|
3 4 0 |{}|
3 5 0 |{}|
4 5 0 |{}|
5 1 0 |{}|
# version string
GraphWin 1.320000
# scaling  wxmin  wymin  wxmax  wymax
1.117676 -10 -5.6875 499.8828 517.6133
# node label font and size
0 13.6121
# edge label font and size
0 11.79715
# node index format
%d
# edge index format
%d
# multi-edge distance
4.537367
# 
# node infos
# x y shape bclr bwidth r1 r2 clr ltype lclr lpos lstr
189.4805 260.8828 0 1 0.544484 12.70463 12.70463 16 4 -1 4 
341.5508 276.0898 0 1 0.544484 12.70463 12.70463 16 4 -1 4 
384.4883 175.9023 0 1 0.544484 12.70463 12.70463 16 4 -1 4 
294.1406 114.1797 0 1 0.544484 12.70463 12.70463 16 4 -1 4 
186.7969 114.1797 0 1 0.544484 12.70463 12.70463 16 4 -1 4 
# 
# edge infos
# width clr shape style dir ltype lclr lpos sanch tanch poly lstr
0.9074733 1 0 0 1 1 1 5 (0,0) (0,0) 2 (202.122,262.147) (328.9092,274.8257) 
0.9074733 1 0 0 1 1 1 5 (0,0) (0,0) 2 (201.1272,255.8074) (372.8415,180.9778) 
0.9074733 1 0 0 1 1 1 5 (0,0) (0,0) 2 (346.5554,264.4124) (379.4837,187.5797) 
0.9074733 1 0 0 1 1 1 5 (0,0) (0,0) 2 (373.998,168.7357) (304.6309,121.3463) 
0.9074733 1 0 0 1 1 1 5 (0,0) (0,0) 2 (372.361,172.116) (198.9242,117.966) 
0.9074733 1 0 0 1 1 1 5 (0,0) (0,0) 2 (281.436,114.1797) (199.5015,114.1797) 
0.9074733 1 0 0 1 1 1 5 (0,0) (0,0) 2 (187.0292,126.8822) (189.2481,248.1803)

next up previous contents index
Next: Geometry Windows ( GeoWin Up: Graphics Previous: Graph Windows ( GraphWin   Contents   Index
Christian Uhrig 2017-04-07