Pajek
Exporting pictures from Pajek to EPS

Vladimir Batagelj and Andrej Mrvar

University of Ljubljana



General Information


This procedure exports picture you obtain using Pajek to PostScript description. If you want to control some general layout parameters of the picture, you must change default values using Export/Options in Draw window:
   Right                   15            %% additional border around ...
   Left                    15            %% ... picture in all 4 directions
   Top                     15
   Bottom                  15
   Background color        No            %% Color of background
   Border Color            No            %% Color of border
   Border Radius            0            %% Border raduis
   Border width             1            %% Border width
   shapes_file             SHAPES.CFG    %% file with shapes definitios

Remember (and to have fealing how big number 15 in additional border is): x and z coordinates of vertices must be between 0 and 1. When Postscript picture is obtained, the square [0,1]x[0,1] is transformed to [0,500]x[0,500].

Crayola colors are used (CMYK - combination of Cyan-Magenta-Yellow-blacK). They are defined in file drawnet.pro that is added in the beginning of any EPS picture you made. You can also define and add your own colors. Be careful - Postscript is case sensitive.
In file shapes.cfg shapes of vertices (ellipses, boxes,...) are defined. Specify full path name (or double click on Edit field) if you want to use special file. If the file cannot be found default file will be generated on the directory where you get EPS picture.

If you have no labels on the picture when you call Export there will also be no labels in EPS picture, otherwise numbers/labels like in Pajek will be shown. If you are looking at the picture using Draw/Partition (some partition of the network is shown using different colors), similar colors will be automatically used in EPS picture too.
But you can for every vertex and line specify how it should be drawn (colors, shapes, sizes, patterns, rotations, widths...). How to do that is explained in details in next section.

Pajek - Definition of Network (and its Picture) on Input Ascii File


A kind of standardized language is used for describing networks. The following reserved words are used:
  1. *Vertices n - definition of vertices follows. n is number of vertices. Each vertex is described using following description line:

    vertex_num label x y 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 - coordinates of vertex (between 0 and 1)
    • shape - shape of object which represents vertex. Shapes are defined in file SHAPES.CFG (ellipse, box, diamond, cross, empty) Meaning of parameters in this file:
      • SHAPE s - s is external name of vertex (used for descriptions)
      • sh - sh can be ellipse, box, diamond, cross, empty This is the name of PostScript procedure that actually draws object (procedure is defined in drawnet.pro).
      • s_size - default size
      • x_fact - magnification in x direction
      • y_fact - magnification in y direction
      • phi - rotation in degrees of object 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 (colors defined in drawnet.pro, case sensitive!)
      • 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 - PostScript font used for writing labels (Helvetica, Courier, ...)
      • HOOKS - positions where edges can join the selected shape - according to s_size. Three different ways to specify these positions:
        1. CART - x y - positions in cartesian coordinates (x,y)
        2. POLAR - r phi - positions in polar coordinates phi is positive angle (0..360)
        3. 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 box ic White fos 20

    Explanation: White box will represent vertex 1, label (vertex one) will be written using font size 20. List of colors (names are case sensitive) can be found in file crayola.ps or Drawnet.pro.

  2. *Arcs (or *Edges) - definition of arcs (edges). Format:

    v1 v2 value [additional parameters]

    Explanation:
    • v1 - first vertex number
    • v2 - second vertex number
    • value - value of arc from v1 to v2
    These three parameters must always be present. If no other parameter is specified, the default arc will be black, straight, solid arc 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 edge (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 (remember that size of PostScript picture is at most [0,500]x[0,500])
    • 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 - PostScript 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)


  3. *Edges - definition of edges. Everything is the same, just type (a), size (s) and position (ap) of arrow must be omitted.

Two different ways of exporting


  • PS - Export to Postscript (.PS) without header (drawnet.pro). Use it to spare space, if you have many pictures and your word processor enables you to define the header separately (like in laTEX).
  • EPS - Export into file with Encapsulated PostScript description (.EPS). Drawnet.pro is already inserted in the beginning. The picture is complete, you can include it into text, make it bigger or smaller (without losing quality), rotate it, print it on Postscript printer, view it with GhostScript viewer, convert it to GIF, JPG...


Back to Pajek manual.