Before you download Pajek

Because Pajek is revised every month or so with new features, you will want to download frequently, so save a bookmark to do so. Most users are not aware that some of the advanced graphic features of Pajek (coloring of lines, etc.) are only available when you export the graphic to a Postscript File and view that exported file, say, in Ghostview. If you need help finding the Ghostview installation package for Windows, you may contact me for the location.

Go directly to Pajek, Software Package for Large Network Analysis

Instructions for GedCom to ordinary graphs with individuals as nodes

For genealogy users, note that the pgraph format is the default for *.ged files, but you can change this by /Option/Read-Write when you (un)click the box for Pgraph -GEDCOM. Then the nodes will be individuals, with triangles for males and circles for females. Once you have your graph note that /Macro/Play clicking plin.mcr from the installation subdirectory will organize the graph by male lines. If you then click the right tab in the Net WINDOW and click the name of the previous datafile, it will be organized by patrilines. Net/Partitions/Depth/Genealogy - /Partition/MakeVector and Operations/Vector/PutCoordinate(Y) will realign the graph with male lines (here is a macro for female lines).

1999 Analyzing Large Kinship and Marriage Networks Douglas R. White, Vladimir Batagelj and Andrej Mrvar. Social Science Computer Review

Download 1ORE.MCR a macro to fix generations when a *.ged file is read in as an Ore-graph.

Further notes on use of pajek

Andrej sent a macro, 12degree.mcr that I edited for 
12degree1mode.mcr - 1 mode data (biotech)
12degree2mode.mcr - 1 mode data (biotech)
These macros have the datafile names, e.g.,
and if you put them all in c:\data (or edit the macro for another dir)
you can do /Net/Transform/Generated in time
and automatically get all the degree partitions for each time period.
The thing to do then is to save them all as data files e.g. 88.clu - 99.clu
and I have a FORTRAN program to put them into an excel file and then...
you can do an excel graphic of the changes in degree distributions over time...
(note to myself: these are stored on C:\data)


..would it be too much trouble when you do the triad census (or as an
..option) to create a 0/1 partition where 0 means not in any
..3-clique, and 1 means a member of 1 or more 3-cliques?  Or if you
..want n means a member of n 3-cliques?

This can be done in the following way (using fragment searching):

1. Generate a 3-clique using
   Net/Random Network/Total number of arcs/
   Number of Vertices: 3, Number of arcs 6, without multiple lines
   Draw the picture to see that it is really a 3-clique.

2. Define it as a first network using
   Nets/First Network

3. Load your data and define it as second network using
   Nets/Second Network

4. Run
   Nets/Fragment (1 in 2)/Find
   and you get it

Results are

1. Partition 0/1 as you wrote
2. Network containing all cliques
3. Hierarchy with all fragments


Jim Moody: For printing pajek output I use the following steps:
  1) Get the image as you want it to appear in the PAJEK drawing window.
  2) Export the file as a .eps file (no clip).
  3) Convert the .eps file into a .pdf file with Adobe Distiller
  4) Read in the .pdf file to Acrobat Illustrator (due to the way
PAJEK writes .eps files, Illustrator can't read it directly).
  5) Once in Illustrator, you can edit the image in many ways.  For example, I will
    a) Almost always change the width of the lines from 2pt to .5 pt
(do this by clicking on one line, then selecting all objects with same
stroke weight)
    b) Often adjust the placement/font of node labels (if I'm using them).
    c) Resize the image to fit the page properly
    d) Add titles, notes, a key if nodes are collored/shaped, etc.
    e) Cut the little spider icon from the page.

..I have just started working on both acyclic decomposition and genealogy
..of subcontracting networks among Japanese firms.
..I cannot figure out algorithms of the two different depth partition as I
do not know
..much about related literature.

In acyclic network you can define 'depths' of vertices in two different

1. acyclic depth partition
all vertices without any lines going in have depth 1,
all vertices to which lines are coming only from vertices
of depth 1 have depth 2,....

2. genealogy depth partition
when finding depth you try to fulfill the following criterion
depth of each vertex should be one higher than depth of vertices
from which lines are coming into given vertex and
one lower than depth of vertices
to which lines are going from given vertex.

Which is better depends on the kind of data you have,
for example genealogy depth partition is better for
genealogies, as the name suggests.



..I wanted to know if you had done a
..routine that would convert what we have from the time-series
..format into the new format.

Read your time series network (*.net) and select
File/Time events network/Save
and you will get network in time events format (*.TIM).

..ok, I see I also have to paste in my *vertices data, and then
..use Net/Transform/GENERATE in time to run the dynamic display.

I attached the file
*Vertices 3
1 "a" [5-10,12-14]
2 "b" [1-3,7]
3 "e" [4-*]
1 2 1 [7]
1 3 1 [6-8]
To transform it to time events network do the folloing:

1. Read the file in Pajek (do NOT run generate in time).
2. Save it as time event network using File/Time events network/Save
3. this way you get your *.tim file, which can be read in Pajek using File/Time events network/Load
4. To see what is happening in time you should use Generate in time as usually and use Previous/Next in Draw window, combining maybe by Layout optimisation if coordinates of vertices are not known in advance.

..why doesnt it att the vertices information 1 to N, labels, coordinates?
This information is attached, of course.



Subject: Removing lines of a certain type

Doug:when I change Options/Reead/Write to 1 I dont get the black
...arcs (type 2) but the red ones.  Suggestions?
Andrej: In Options/Reead/Write, maybe you did not type value 1 correctly,
(e.g. 1.0000).

The other possibility to get only black or red lines without
changing threshold and reading network again is
Net/Transform/Remove/lines with value/ lower than
Net/Transform/Remove/lines with value/ higher than
This option was added in Pajek 0.48.

Subject: Move

Doug: how do I use Move/Grasp/Closest class and lower to move nodes in
a genealogy?

Andrej: You can do that in current version using Move/Grasp/Closest class and lower,
after you compute k-neighbours (input or output of given vertex),
draw it according to obtained partition and click close to the last
colored vertex.

Notice that Move/Grasp/Closest class and higher is not convinient
in this situation, since all vertices not reachable from given
vertex are put in class 999998.

> Doug:
> 1. RE: Would it be possible in
> Info/Partitions following Net/Partition/Vertex Labels to show the
> labels that were partitioned next to the partition numbers
> alongside the frequencies of nodes?  For example, I have this
> huge 4000 node Florentine families bicomponent with family names
> on the nodes and after I do a Vertex Labels partition I want to
> see the subgraph for the Medici family.  Showing the labels would
> enable me to this rather quickly.
> :: the file is attached: labels are names

Andrej: I see now the use of your suggestion.
I will include it in Info/Partition in next version of Pajek.

> 2. I need to transfer the numbers in a *.cls or *.clu (of
> the same dimension as the *.net) to show as LABELS of the graph.
> Any easy way to implement this?  I can do it with a text
> processor of course, but that isnt very elegant.
Andrej: There is no better way to do it in the moment.

Doug: Suggestions (not shown) as to dates files

Andrej: Hello!
I tried to do what you had recommended. When searching for dates
I start at the right of DATE field and find first number
and go to the left as long as numbers exist. In this way
you get numbers if 4 digits is used and also if
only 2 digits are used (in this case I add 1900 to the year).

I attached a zip file ( with clinton.ged and vectors
(birth, marriage and death years) that you obtain
from it when you read file as p-graph and Ore graph.

I generate vectors not partitions, because in partition
you can have only positive numbers.
But you can always generate partition from vector
using Vector/Make Partition/by truncating.
If we will use dates only on data from year 0 on,

Subject: Re: panning

Andrej: Did you try to use Scrollbars when a part of a picture is selected
(Scrolbar On/Off).

Subject: Re: export to ucinet

Andrej: To save in Ucinet DL format you should:
click Save and change the bottom option in window:
Save as type   to
UCINET DL files.

Subject: Eigenvalues

> Doug: It is not so obvious.  I have my graph loaded, let 1 1 1 be the
> option ... and nothing seems to happen.  I sense I am missing something?
> Are there a few little steps or instructions?
Andrej: When you select 1 1 1 program tries to find eigenvectors
which corresponds to first (largest) eigenvalue,
which must be triple. If it is not in message
window corresponding message appears.
In real nonsymmetric data it is small possibility
that first eignevalue is multiple, so
you have to select 1 2 3, to find first second
and third eigenvalue and corresponding
eigenvectors. And these become coordinates
of the vertices on the picture.

The results are fine on symmetric graphs (for example
cubic graphs), but on real graphs pictures are not so fine.

Subject: valued matrix

> Doug: How do you save results as a valued matrix ???

Michael Schnegg: use the option file\network\save and chose pajek
valued matrix (*.mat) as data format. you must of course have the
shrunken matrix in the network menu ...

Subject: noncontuguous range of clusters

Andrej: Pajek 0.45 includes extracting noncontuguous range of clusters -
clusters given using cluster generate a binary partition.

Subject: spring embedding

Andrej: spring embedding with parameter (e.g. 0.2 or 0.1 when asked or in
"factor) includes the Fruchterman-Reingold algorithm, implemented according to
the article written by them.

Andrej: About your idea of computing distances from the largest bicomponent:
   It can be considered in different ways, but the best, I think, is that
   you take the bicomponent as a compound vertex, shrink it and work with
   a obtained network as a new genealogy - compute and draw it according to
   genealogy depth partition ...
   The general idea of shrinking is to consider vertices in one class of
   hierarchy (or one class in the partition) as a new vertex, and
   collecting all lines going into/from the group in that single vertex.

   How this can be done in your case?
1. Read the genealogy.
2. Compute bicomponents - result is hierarchy.
3. Double click the obtained hierarchy to see the sizes of bicomponents.
   Click on the largest bicomponent once to mark it, choose Edit/Change Type
   from the menu in the current window (or press Ctrl T).
   At the right side of the largest bicomponent "(Close)" should appear,
   if it does not, you pressed Change Type too many time, so keep pressing
           Change Type until it appears - it is a circular option.
4. Select Operations/Shrink Network/Hierarchy, select "Yes" for checking
   if network is simple, and choose "1" for the minimum number of connections.
   Vertices in the "closed" group will be shrunk.
5. You obtain a new network of dimension = dimension of original network
                                          - dimension of bicomponent
                                          + 1
   The network is not acyclic yet, because there exist loops (there were many
   arcs inside bicomponent that produce loops when shrinking). The loops
   can be deleted by Net/Transform/Remove/loops.
6. After that the network can be considered as ordinary genealogy,
   and all suitable analyses can be done,
   the shrunk vertex will have vertex number 1, but you will
   notice it easily because there are many lines going in and out of it.

I hope this is what you would like to get and that the procedure is not
too complicated,

With best wishes,

Subject: Good news!


New version of Mage 5.28 can be found on Internet. It is dated October 1998.
It is designed expecialy for Win95/NT, and is able to handle larger files,
for example the file with 532 vertices that you sent me few days ago,
which was too large, can be read with a new version without problems,
and animation works fine too.
The new version can be found at:


>>>>Cluster/Make Partition from Cluster
>>>>behaves weirdly for me however.
>>>>say I put
>>>>and make the dimension 9 then make partition
>>>>Nothing changes when I draw the partition

The cluster you have, tells that you are interested in all vertices (1..9).
When you make a partition all vertices goes to class 1 - yellow
(otherwise unselected vertices would go to class 0 - cyan).

>But when I HAVE an existing partition and do the same thing
>then my cluster appears yellow but the other nodes are still
>differentiated (with color shift

If you read above 9 numbers as a partition, it means that every vertex
belongs to separate class,
so every vertex will be in different color. But maybe I do not understand
what you mean?

>>>>It would be a great boon to editing if we could use the right
>>>>mouse button to move not only a point but all the succeeding
>>>>and clicking CLOSE to the point with right mouse button, move the
>>>>point and all the preceding points

I will add an option in the next version of Pajek Move/Grasp in Draw window,
where you can determine what will mean 'clicking close to vertex of given
moving only vertices of that color, moving vertices of that color and higher,
moving vertices of that color and lower.


>>>>when I have selected and edited my matrilines, when I save the
>>>>file, only the female links (naturally) are saved.
>>>>How do I put these new coordinates on the original 2-relation

I think that you have already found the answer (according to additions you
made for a paper)
Using First network for female network and Second Network for complete
and then using Union of Lines the coordinates of the female network will
be used in the new network obtained. But be careful, in a new network every
link will exist twice, to delete multiple arcs you should run
Net/Transform/Remove/Multiple Lines


>>>>AllBef and AllLat for selecting predecessors or successors (all
>>>>descendants, all ancestors or
>>>>isnt this right if arcs point up to parents

The two macros are taking directions of arcs in p-graph into account,
so AllBef finds ALL people BEFore selected person (ancestors),
and AllLat finds ALL people LATer than selected person (descendants)


I read the blue part of the paper too:

>>>>Defining and moving matrilineages in a P-graph is obtained by
>>>>changing the Options/ReadWrite Threshold to 1 (be careful to set it
back to
>>>>the default=0 when done since it is otherwise reset for the next run)
>>>>and saving a separate file with the female network, after moving
>>>>Reconstituting the new configuration involves the multiple network option
>>>>Nets/First Network and Nets/Second Network, entering the file
containing the
>>>>female network in the first case and the entire network in the second.

After that female links will exist twice in a network, so as I said
deleting multiple lines using Net/Transform/Remove/Multiple Lines
or another difference should be done.

>>>>Defining patrilineages also involves the multiple network option
Nets/First Network
>>>>and Nets/Second Network, again entering the saved file containing the
female network
>>>>in the first case and the entire network in the second.
>>>>Nets/Difference will then subtract the arcs in the second from the
first and
>>>>the result will be the male lines, which can be saved to a file after
>>>>are moved about.
>>>are moved about.


the entire network in the first case and the female network in the second.

 ...w 2 as a line width command doesnt seem to work,
 I checked on my examples and it works, maybe send me your file to check it


 MATRILINEAGES, PATRILINEAGES can be (at the moment) obtained using
 of some basic operations. Explanation:

 Look at Options/ReadWrite Threshold.

 You have probably a value 0 in that field. It means that every line in the
input file
 that has value greater than 0 will produce a line when the data will be read.
 In the case of p-graphs where you have only values 1 and 2 it means that
 genealogy will be read.

 If you want to get only 'female links' you should change the threshold
value to 1
 (values larger than 1 - in our case 2 - will produce a line).

 For obtaining 'male links' (value 1) the procedure is a little more

 1. Read entire genalogy (with value of threshold = 0).
    Choose the network as the first network in Nets/First Network.
 2. Read only female links (with value of threshold = 1).    Choose the network as the second network in Nets/Second Network.
 3. Compute difference of the two networks in Nets/Difference.
    In the obtained network only links of type 1 (male) will exist)

 After that computing weak components will give you  MATRILINEAGES,


Clusters are just sets of units. For example if you have a network of 100
and you are interested only in units 23, 44, 58 and 87, you write on input


Afterwards you can extract the subnetwork, consisting only of the four
and connections between them. So it has no sense to have multiple equal values
in the CLS file.

What you prepared (with multiple 1's, 2's and 3's) is actually the partition.

Anyway, clusters and partitions are very similar, you can always get
cluster from


I read only the magenta part of the paper and I am satisfied with the
explanations. Here are only minor bugs:

Page 21
AllBef and AllLat for selecting predecessors or successors (all
descendants, all ancestors or
AllBef and AllLat for selecting predecessors or successors (all ancestors,
all descendants or


When you click for saving you must check which option is
selected in
"Save as type "
This option is saved and restored after you re-run Pajek,

Best wishes,


The problem is that Pajek does not allow numbers to begin with .
So I replaced all . with 0. and it worked. I attached the modified

Best wishes,

Subject: answer

to my own question (from PREKIN documentation):
cant put labels on lines but adding
after every
@balllist ...
puts the labels on the graph !!
would be a good/easy default (or option) to add to MAGE output.

Subject: Matrix format


Your suggestion for having matrices in Pajek was correct.
You can see how the matrix format should look like by saving
any network (not too big I suggest ) in matrix form -
after selecting Save/Network select matrix type:
Pajek Binary Matrix (*.mat) or
Pajek Valued Matrix (*.mat)

Be careful, when reading matrices, the value in
Options/ReadWrite Threshold should be >=0, otherwise
value zero in matrix can produce an arc.

Anyway here is an example of metrix:

*Vertices      9
     1 "aaaaa1"     0.5228    0.0456    0.5000
     2 "bbbbb2"     0.4449    0.2716    0.5000
     3 "ccccc3"     0.3084    0.0737    0.5000
     4 "ddddd4"     0.4236    0.5108    0.5000
     5 "5"          0.6340    0.4082    0.5000
     6 "6"          0.3320    0.7413    0.5000
     7 "7"          0.0886    0.8095    0.5000
     8 "8"          0.2545    0.9544    0.5000
     9 "9"          0.4750    0.9507    0.5000
0 1 1 0 0 0 0 0 0
1 0 1 1 1 0 0 0 0
1 1 0 0 0 0 0 0 0
0 1 0 0 1 1 0 0 0
0 1 0 1 0 0 0 0 0
0 0 0 1 0 0 1 1 1
0 0 0 0 0 1 0 1 0
0 0 0 0 0 1 1 0 1
0 0 0 0 0 1 0 1 0


I was playing with Pajek and finally dound out what is the problem
of not saving colors and shapes of lines (it is not problem
of Pajek 0.33, it was always the same).

If you are using labels of lines as well, you should change your
ego2cpl program at the place where you are writing out
lines so that the part
c Black p Solid
appears in description of every arc not only at the first
(as you already have in the case of c Red p Dots).

Just for information, why is that so:
Pajek tries to minimize space for storing lines, and
if you are using lines without labels it is successful
because the data for many lines is the same (color and shape),
while when using labels of lines description of
every line is different and therefore complete description must
be written. For example I am attaching -
the largest bi-component of your example that you are using
in SSCORE paper.

And about your suggestion to add @labellist in export
to Kinemages, I decided to include it as a new option in next
version of Pajek.

With best wishes,

Subject: Some answers


I think that the way that Pajek 0.33 saves colors, types of lines,
line labels is still the same as it was before.

About Mage, as far as I know it is not possible to add labels to lines.
About labels of lines:
I checked the possibility of using @labelllist as you suggested and
it worked. But I think that the layout you obtain this way is too
crowded, especially when netoworks are a little larger, the labels
are written one over the other. If you use @labelllist the vertices (balls)
are also not drawn anymore.

The other possibility of getting fixed (selected) labels is:
Use (in Mage) - Edit/draw new/ and press OK. On the right handside some new
options appear, check Labels, and afterwards for every vertex you thouch
its label stays fixed on the layout.

What do you think about that option, or do you still prefer
the @labelllist option?


>that I build from the outside (attributes of nodes)
>when I reduce the graph to exclude those of zero degree (or
>the partition is not reduced along with it.
>Hence when I reimport the partition, it is misaligned with the
>new numbering of nodes.
>Is there any way to keep such alignment following reduction?
The same operation that you made on network (extract)
should be done on partition.
This can be done in the following way:
Partitions/FirstPartition - select your partition
Partitions/SecondPartition - select the same partition
Partitions/Extract Second From First - select the same
         classes as you did when extracting from network.

In general first and second partition can be different
- extracting from one partition vertices determined by
second partition.


A have one more comment about Turkish nomad example:
Can you send me the appropriate file - maybe I do not have the same file. I
got different results for number of ancestral nodes and relinking index.
Can you check results once more -- in the case of bicomponent of 250
vertices I got 14 ancestral nodes and relinking index 0.75 (even from the
picture in the paper it seems that there exist more than 5 ancestral
nodes). But even using 5 ancestral nodes I get different relinking index


Inside Pajek you cannot find clusters using
Blockmodeling. You can only for specified partition
into clusters find if there are some connections
among clusters according to specified Blockmodel.
You can do that in thiw way:

- Select Blockmodel
  I suggest you to try first the simplest blockmodel
  (0. Min. number of links = number of links that must
   exist among clusters to produce a link in new network)

- Select Network,

- Select (or make) Partition (.clu) of the same size
  as is the number of vertices where
  p[i]=k, means that vertex i belongs to cluster k,
  p[i]=0, means that vertex i does not belong to any

When Shrink/Partition is executed, vertices that
belong to the same cluster are shrunk to one vertex,
vertices that are in class 0 are left unshrunk.
You get as a result new network where number of vertices
is equal to number of clusters plus number of vertices
in class 0.
Shrunk vertices get names as 'SHR'+name of first vertex from cluster
Unshrunk vertices have unchanged names.

After that, algoritm checks if there exist any
connection among clusters according to specified blockmodeling.

Instead of shrinking according to partition (CLU)
you can use hierarchy (HIE) too.
The main idea is similar but you can also express
some additional information. I will explain it
to you later (or maybe in Sitges),
when you will be able to do shrinking using partitions.

I attached three additional files to make things more
- - example of network
- shrink.clu - example of partition
I suggest you to first load both objects into Pajek
and run Draw/Partition, to see clusters,
then run Shrink/Network with 1 as min. number of lines.
The result that you should get is attached as file

Best wishes

Subject: Re: have blockmodeling papers now


In Pajek you have to specify blocks and then select
appropriate blockmodel. The program then finds if there exist
some connections between blocks  according to selected model.

But if you want to use the whole power of Blockmodeling
you have to use program Model. If you will have some questions
about that program you have to ask Vladimir, because he is
the author of that program.


Subject: Re: blockmodel

>Alexis Ferrand and I are up to questions of blockmodeling with
>PAJEK (Univ. Lille).  What is the reference:
>Doreian, Batagelj, Ferligoj: Blockmodeling.
>that explains the procedures, and can you give us a brief resume of
>the procedure?

  wbw,   Vlado

Subject: Labels on Arcs

In Pajek, you number vertices and ALSO have labels for vertices.

For arcs and edges, however, you have values (numbers), but you
do not allow additional labels for them.  Such labels (or the values)
could easily be drawn (if selected as a manu option) at the midpoint of
the line.

The Options menu, in addition to
        Mark vertices using
could have
        Mark arcs using
        Mark edges
(all three with the menu options at the next level, but also including:
  assign colors to different values
  assign colors to different labels)  [values and labels dont have to
agree; no computation would be done with the labels]

This option would be very useful for p-graphs, where the arcs are of
different {color ; value; e.g. for the two sexes, e.g. -1 and +1 if you
were evaluating balance} but teach carries the name or label of a specific

Subject: Re: *.ged files

You can delete edges by:
Network/Transform/Remove/all edges

Subject: Re: suggestion


You can spin in all three directions also pressing or holding the keys:
X, Y, Z: rotating around axis defined by the key
S: spinning around normal defined by normal (default 1 1 1).

When the part of picture is selected (with right mouse button you select
area), scrollbars are used for travelling left/right or up/down.

Best wishes

>I have arcs of value 2 and arcs of value 1.
>Can I color them differently?

If arcs of value 2 are together and arcs of value 1 together it is easy:
Part of input file - definition of Edges should look like that:

     48     49       1 c Red
     49     50       1
      7      9       1
     12     14       1
     12     13       1
     12     15       1 c Blue
     23     24       1
     23     27       1
     27     30       1
     27     29       1

This intermediate page has been accessed times since May 26 1999.

back to home

back to Toolkit