Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

ESSIe Summer School

Social Network Analysis


8-9 July 2013, Prishtin
Pajek guide/commands used
Practical example group links
Network with 24 vertices, generated from the ex-ante survey results
the following persons were excluded: people who do not attend this session and informed us about it;
people who did not answer the ex ante survey; people who did not specify any links to anybody else
(reduced version of 31 nodes)
Line value 1 = have talked to this person during this course
Line value 2 = have seen this person before

Pajek file formats


.net networks
.clu partitions
.vec vectors
.paj Pajek project files (here, you can save entire sessions with all networks, subnetworks, partitions,
vectors etc that you created)
See example networks (in notepad) for the formatting/syntax

How to get your data into Pajek?


There are several ways to get your data from xls, csv or any other files into Pajek. First, you can write the
.net file manually using notepad (following the syntax as specified in our example .net-files). However,
the more convenient option is to work from Excel or statistical software. All you have to is to get your
network data into the following format
nodeX nodeY linkvalue
nodeX nodeZ linkvalue
nodeZ nodeA linkvalue
etc.
for instance:
124
235
131
341
If you have this in a separate table in an xls file, you save as .txt (MS-Dos). The .txt-file can then be
specified as the input file in the small programme txttopajek. This programme creates your .net file out
1

Alexander Degelsegger, ZSI

of the txt-file (dont forget to define whether you work with a directed or undirected network and
whether it is a one-mode or a two-mode network!).
The line values can be continuous (age, number of communications, monetary values of transactions
among firms, etc.) or are coded at a categorical scale (with 0 signifying no relation, 1 a type of relation, 2
another type of relation, etc.).

Basic operations in Pajek


Import network: File->Network->Read or read symbol in network line
Import partition, etc.: similar procedure
Get basic infos about the network: Network->Info; experiment with/explore general and line value
information
Draw network: Draw ->network
If you have a partition or a vector or both: Draw->Network+First Partition or
Draw->Network+First Partition+First Vector or
Draw->Network+First Partition+First Vector+Second Vector
The dropdown list in the network, partitions, etc section in Pajek is a kind of history much like in the
browser that allows you to select networks, partitions, etc you created or imported in your current
working session (or in the one you loaded using a .paj file).
Keep in mind that if you draw a network, a partition and vectors, the number of vertices in all the files
(specified in brackets at the end of the network, partition etc name) has to be the same, otherwise Pajek
will respond with an error.
If the line values are too thick, you can create a new network with variable, but reduced line values:
Network->Create New Network->Transform->Line Values->Multiply by
Specify value, e.g. 0.2

Optics
Once you have drawn your network in Pajek, you can use different commands to adapt the appearance:
- Use the algorithms in the Layout menu for positioning vertices (e.g. Layout->Energy->Kamada
Kawai)
- Display line values as line thickness: Options->Lines->Different Width
- Mark vertices using different labes: Options->Mark vertices->
o ->labels
o ->vector values (if you are also displaying a vector)
o ->partition clusters (if you are also displaying a partition)
- Choose colors of vertices: Options->Colors->Vertices; choose color;
- You can also define the color for the background, the vertex borders, the arcs and edges
- If you use a partition, you can choose the colors assigned to each cluster in the partition in
Options->Colors->Partition colors->for Vertices; click on the color you want to change and enter
the number of the color you want to assign
- Export the network view as images using the Export menu
2

Alexander Degelsegger, ZSI

Troubleshooting
My network view (after drawing it) does not show any lines?
Did you import a .net file as network (or by mistake a .clu file)? Is it the correct one?
Check in Options->Lines->Draw lines whether your line type (edges or arcs or both) is correct. If
you only display arcs, but you have an undirected networks only containing edges, then no lines
are displayed.
My vertices are invisible?
Are you using a vector in the drawing whose values might be zero (inspect with the values of the
vector using the magnifying glass symbol
Try Options->Mark vertices using->labels
Try Options->Size->of Vertices; you can specify the base size of the vertices here, meaning that
if you use vector values to determine vertex size, the values will still be used, but are multiples of
a base size that you can specify here.

Reducing complexity in the network


Complexity in a network can be reduced by
Reducing lines (arcs or edges) between vertices
Network->create new network->transform->remove
E.g. remove lines with a value lower than a threshold (specified depending on your coding); in
our example you might choose to remove lines with a value higher than 1 to get only the lines
coded with value 1 (have met and talked to during ESSIe course in February); you can also
choose to remove lines with values lower than 2 to get only the knewn before links
Similar: Network->create new network->transform->reduction
or by reducing the number of vertices (and, as a result, lines)
You can extract a sub-network based on partition clusters; for instance, if we have our example network
of the groups links and the affiliation participation, we might choose to only look at the University and
College colleagues or, conversely, only at the NGO/private sector members
This is done by: Operations -> Network+Partition ->Extract Sub-network
[see below: this can be combined with k-cores: for instance, you calculate cores; information on cores is
saved in partitions (which vertex belongs to which core) if you extract a sub-network based on the
core-partition, you can reduce the size of the network by selecting only the cores you want to focus on]
You can also limit complexity by focusing on specific components only:
Network->create partition->components

Alexander Degelsegger, ZSI

Centrality
Calculate centrality measures: Network->Create Vector->Centrality->
-

Degree
Closeness
Betweenness

The result is a vector with the numerical values of the centrality measures. You can draw the
Network (and the partition) and the vector using the Draw menu (Draw Network+First Vector
or Network+First Partition+First Vector etc). The vector values are displayed as vertex size. If the
vertices are very small (e.g. because of normalized centrality measures e.g. in the case of
closeness or betweenness centrality), then you can use multiplication to make the vertices
bigger:
Vector->Transform->Multiply by
Draw network and vector again

Roles
Operations -> Network+Partition -> Brokerage roles (between institutions, between courses)
The data on the roles (to what degree do vertices fulfill the role we are looking at) are saved in
five vectors that are created right after carrying out the ->Brokerage roles command;
You can discplay the network with the vector for the specific role (representative etc) and the
partition displaying institutional affiliation etc (Draw->Network+First Partition+First Vector)
The size of the vertex shows the degree to which an actor fulfills a role
It might be useful to multiply the vector to get vertices of a reasonable size (Vector->Transform>Multiply by)
Take into account that in undirected networks, representative and gatekeeper positions are the same.
For the liaison function, at least three groups have to be defined in the partition

Cores
You can calculate cores in a network by using this command:
Network -> Create Partition -> k-cores
The cores are translated into a partition that you can draw. Remember that a 2-core ,for instance
,consists of all vertices with links to at least 2 other vertices, a 3-core of vertices to at least 3 other
vertices, etc.

Alexander Degelsegger, ZSI

Block modeling
Network->Create Partition->Blockmodelling (e.g. Random Start)
Choose equivalence model
Run
block model appears as a new partition

Practical example Austria-India co-publications


1.
2.
3.
4.
5.
6.

Inspect network file (open .net file)


Import network
Network -> Info | inspect results
Draw network (Draw->Network)
Options -> Lines -> Different Widths | What has happened?
Adjust line values! Close draw window; Network -> Create New Network -> Transform -> Line
Values -> Multiply by e.g. 0.2
7. Draw; Options -> Lines -> Different Widths
8. Play around with Layout algorithms (Layout->Energy->Kamada-Kawai->Free)

Add country code as partition:


1.
2.
3.
4.
5.
6.

Inspect .clu-file
Import partition
Partition -> info
Draw network and partition (Draw->Network+First Partition)
[if labels are not visible: Options->Mark Vertices Using->Labels)
Change vertex colors: options -> colors -> partition colors -> for vertices | adjust | redraw

Add vertex values (number of publications in 2012) as vector:


1.
2.
3.
4.
5.
6.

Inspect .vec-file
Import vector
Vector -> Info
Draw network | ?
Adjust vertex size: Vector -> Transform -> Multiply by -> e.g. 0.02
Play with Layout again (Fruchterman Reingold -> 2D)

Alexander Degelsegger, ZSI

Calculate different centrality measures


1.
2.
3.
4.

Network -> Create Partition -> Degree


Network -> Create vector -> Centrality -> etc.
View/edit vectors
Draw network and show vector values (Draw-Vector to show centrality measures as vertex size)

Data object: Clusters


Clusters are needed for a series of calculations within Pajek (typically those that only function will small
networks or subset (clusters) of larger networks)
Create a cluster either by: Cluster -> Create Complete Cluster (the entire network will be represented in
the cluster)
Or by: Partition -> Make Cluster -> Vertices from Selected Clusters (in the above example, if we choose
class 1, only Austrian institutions will end up in the cluster, if we state 2, only Indian ones will be
represented)
For the calculations: Operations -> Network+Cluster -> (e.g. dissimilarity measures that are sometimes
needed for block modelling)

Alexander Degelsegger, ZSI

You might also like