Definition of Network (and its Picture) on Input Ascii File
The following reserved words are used:
- *Vertices n - definition of vertices follows.
n is number of vertices. Each vertex is described using
following description line:
vertex_num label x y z shape [changes of default parameters]
Explanation:
- vertex_num - vertex number (1, 2, 3...)
- label - if label starts with character A..Z or 0..9 first blank
determines end of the label (example: vertex1), labels
consisting of more words must be enclosed in pair of
special characters (example: "vertex 1").
- x, y, z - coordinates of vertex (between 0 and 1)
- shape - shape of object which represents vertex.
Shape can be described with additional parameters:
- x_fact - magnification in x direction
- y_fact - magnification in y direction
- phi - rotation in degrees of vertex shape in + direction (0..360)
- r - parameter used for rectangle and diamond for describing
radius of corners (r=0 rectangle, r>0 roundangle)
- q - parameter used for diamonds - ratio between top and
middle side of diamond (try q=0.01, q=0.5, q=2, ...)
- ic - interior color of vertex
- bc - boundary color of vertex
- bw - boundary width of vertex
- lc - label color
- la - label angle in degrees (0..360)
- lr - distance of beginning of vertex label from vertex center (radius - first polar parameter)
- lphi - position of label in degrees (0..360) (angle phi - second polar parameter)
- fos - font size
- font - font used for writing labels (Helvetica, Courier, ...)
- HOOKS - positions where edges can join the selected shape
these positions:
- CART - x y - positions in cartesian coordinates (x,y)
- POLAR - r phi - positions in polar coordinates, phi is positive angle (0..360)
- CIRC - r phi1 - iteration of positions in polar
coordinates r - radius, phi=k*phi1
k=1,2,..; k*phi1 <= 360
Default values can be changed for each vertex in definition line,
example:
1 "vertex one" 0.3456 0.1234 0.2322 box ic White fos 20
Explanation: White box will represent vertex 1, label (vertex one)
will be written
using font size 20.
- *Arcs (or *Edges) - definition of arcs (directed links) and edges (undirected links). Format:
v1 v2 value [additional parameters]
Explanation:
- v1 - first vertex number
- v2 - second vertex number
- value - value of edge/arc from v1 to v2
These three parameters must always be present. If no other parameter is
specified, the default edge/arc will be black, straight, solid with
following exceptions:
- if value is negative, dotted line will be used instead of solid,
- if loop (arc to itself) is found, bezier loop will be drawn,
- if arcs in both directions are found two curved bezier arcs will
be drawn.
Arrow will be drawn at the end of the arc (at second vertex).
As we mentioned, hooks are used to specify exact position where line
joins vertices.
Additional parameters:
- h1 - hook at starting vertex (v1)
(0 - center, -1 the closest, 1, 2.. user defined)
- h2 - hook at second vertex (v2)
- w - width of line
- c - color of line
- p - pattern of line (Solid, Dots, Dashed)
- a - type (shape) of arrow (A or B)
- s - size of arrow
- a1 - angle at vertex 1
- k1 - velocity at vertex 1
- a2 - angle at vertex 2
- k2 - velocity at vertex 2
- ap - position of arrow
- ap = 0 - arrow at second vertex
- 0 < ap <= 1 - proportional distance from second vertex
(according to line length)
- ap > 1 - absolute distance
- l - line label (look at description of label format at shapes)
- lp - label position (look at ap)
- lr - label radius (position of center text from point on edge )
- lphi - label radius (angle of center text according to point on edge )
(lr and lphi are polar coordinates)
- lc - label color
- la - label angle
(0 < la < 360 - relative to edge)
(la >= 360 - absolute angle according to x axis)
- fos - font size of label
- font - font used for writing labels (Helvetica, Courier, ...)
Special shapes of lines can be defined using combinations of
alpha1, k1, alpha2, k2:
- alpha1=alpha2=0, k1>=0, k2>=0 - straight line
- alpha1=alpha2=0, k1=-1, k2>0 - oval edge with radius k2 (measure
of radius is absolute as explained above)
- alpha1=alpha2=0, k1=-1, k2<0 - second possible oval edge with radius -k2
- alpha1=alpha2=0, k1=-2, k2>0 - circular arc with radius k2 in positive
direction
- alpha1=alpha2=0, k1=-2, k2<0 - second possible circular arc with radius -k2
in positive direction
- alpha1=alpha2=0, k1=-3, k2>0 - circular arc with radius k2 in negative
direction
- alpha1=alpha2=0, k1=-3, k2<0 - second possible circular arc with radius -k2
in negative direction
- alpha1=alpha2=0, k1=-4 - double edge
- alpha1 or alpha2 <> 0, k1>0, k2>0 - Bezier curve
(if angle1 and angle2 have different signs line goes from one to
another side of straight line connecting both vertices,
if angle1 and angle2 have the same sign - line stays on the same side
of straight line connecting both vertices)
Colors in Pajek
List of colors (names are case sensitive) can be found in Pajek manual.
Additional to predefined colors described with color names it is possible to specify colors using RGB or CMYK format.
There are two ways how to specify colors in RGB and CMYK (using hex numbers 00-FF, or decimal numbers 0-1).
Examples: RGBFF0000, RGB(1,0.8,0), CMYK00FF0000, CMYK(0,1,0.8,0). There should be no spaces in string defining a color.
See cmyk.net and rgb.net
Some hints
- % stands for a comment: if row in input file starts with % this comment will be displayed in Report window while reading the file.
- In Pajek NET file there should be no empty rows after *Vertices statement - empty row means end of network definition.
- \n stands for new row - label of vertex will be displayed in two (or more) rows.
|