DataFormats»Pajek Net And Paj Formats

Pajek Net And Paj Formats

Main website:

Maintainers / Authors:

Vladimir Batagelj & Andrej Mvar (spelling?)

Specification:

The basic (extended) format is described in the Pajek's manual http://vlado.fmf.uni-lj.si/pub/networks/pajek/doc/pajekman.pdf pages 67-71.

The later additions: two-mode networks, multi-relational networks and temporal networks were described in details in materials for our workshops. The last version is available at http://vlado.fmf.uni-lj.si/pub/networks/doc/ECPR/ECPR02.pdf.

Example Parser implementations

Java

from JUNG PajekNetReader

C++

Converter Programs:

Excel2Pajek PajekConverter

Features:

Pros:

  • Simple to use
  • Widely accepted Pajek UCINET JUNG
  • The selection for named optional data was made to avoid listing all the data for each element. The required data have fixed positions at the beginning of the line followed by list of named optional data. Similar solution is used in procedure parameters in several programming languages.
  • Can use multiple files for attribute data (.vec) or combine files in .paj project file

Cons:

  • It is very rich, but much of the richness is hidden (nick's example includes less than tenth of the features) This means it is very hard to know when I've got a "complete" parser. In other words, I can write something that will read a basic file easily, but then someone will pass a more complex file which works fine in pajek but crashes my program.
  • it is mixed mode. Some of the elements are in columns, delimited by white space, and some of the elements are indicated by tags, some of which are order dependent and others which are not. This makes writing a parser fiendishly complex, greatly reducing the likelihood of compatibility.

Very Basic Example

(does not demonstrate most features, time, attributes)


*Vertices      9
    1 "1"    0.3034    0.7561
    2 "2"    0.4565    0.6039
    3 "3"    0.4887    0.8188
    4 "4"    0.5687    0.4184
    5 "5"    0.3574    0.4180
    6 "6"    0.7347    0.2678
    7 "7"    0.9589    0.3105
    8 "8"    0.8833    0.1269
    9 "9"    0.7034    0.0411
*Arcs
*Edges
     1      2       1
     1      3       1
     2      3       1
     2      4       1
     2      5       1
     4      5       1
     4      6       1
     6      7       1
     6      8       1
     6      9       1
     7      8       1
     8      9       1 

Example of .paj

The dot .paj (pajek project file make it possible to include individual node data, partitions, and multiple graphs in the same file. This is done by adding a header to each section.


*Network myNamedNetwork
*Vertices      9
    1 "1"    0.3034    0.7561
    2 "2"    0.4565    0.6039
    3 "3"    0.4887    0.8188
    4 "4"    0.5687    0.4184
    5 "5"    0.3574    0.4180
    6 "6"    0.7347    0.2678
    7 "7"    0.9589    0.3105
    8 "8"    0.8833    0.1269
    9 "9"    0.7034    0.0411
*Arcs
*Edges
     1      2       1
     1      3       1
     2      3       1
     2      4       1
     2      5       1
     4      5       1
     4      6       1
     6      7       1
     6      8       1
     6      9       1
     7      8       1
     8      9       1 
*Partition gender
*Vertices      9
1
2
1
2
3
1
1
2
1
*Vector age
Vertices     9
20
22
18
20
21
19
25
50
35