MA267 - Introduction to Pajek


Introduction

If you have not yet downloaded Pajek, you can get it at this website. If you have not yet downloaded the Pajek file "prerequisites.paj" from our Blackboard site, click this link to get it now. I will be walking you through exploring the data in that file using Pajek.

It is the network of all courses offered at Bentley in Fall 2006, with the relation "is a prerequisite for." (Actually, the relation is "is mentioned in the prerequisite list for," so some courses say you need X or (Y and Z), and so all three are marked as prerequisites. But that's not really that important.)

In this file, things written like this: Edit > Copy mean that you should click the Edit menu in Pajek, and then choose the Copy menu item.

Opening a data file

You can open Pajek first (from wherever you installed it on your machine) and then load the data file by File > Pajek Project File > Read. The shortcut for this menu item is F1.

Alternatively, you can double-click the .PAJ file in Windows Explorer and when Windows asks you where the program that opens such files is, you point it to Pajek. This way you can always double-click .PAJ files afterwards and it will remember to use Pajek to open then.

When you have loaded the data into Pajek, you will see the text "Bentley Prerequisites Fall 2006 (168)" under the Networks section in the program. Pajek deals with networks, partitions, vectors, permutations, clusters, and hierarchies. The data file you opened only contained a network and a partition, so those two things should be visible.

Seeing a graph

You can see a picture of the network by choosing Draw > Draw (the shortcut for which is Ctrl+G). Initially the program doesn't lay out the nodes in a very helpful way. You see this 168-node network shown with elements in one big circle, as in the following figure.

We can ask Pajek to make more intelligent decisions about network layout using the Layout menu above the image. Try, for example, Layout > Energy > Fruchterman Reingold > 2D. It will take a little time for it to stabilize, but when it does it should be better off than when it started, such as the following picture. Still not great, but better.

If you see particularly badly laid out sections of the graph you'd like to tweak by hand, simply click and drag on a node to reposition it. This is especially useful for small graphs, or for small sections of a large graph.

Partitions

The Bentley courses data comes with a partition which you've already seen on the main Pajek window, the partition called Departments. It partitions the courses into the departments from which they come, by simply dropping the course numbers. So MA126 is taught by the MA department, and PH311 by the PH department. This is a bit wrong, because we have no departments GB or EXP, but it's close enough. To see the department partition in the graph using node color, go back to the main Pajek window and choose Draw > Draw-Partition (or Ctrl+P). It should respect your layout, but just redraw the nodes in new colors, as below.

This is beginning to be interesting--we see the MG courses all clustered together, the CS courses all clustered together, and so on. Courses like the GBs, as you might expect, are all spread throughout the network.

Vectors

A partition just groups nodes together, but a vector can assign to each node a particular numerical value that can be displayed in the graph using the nodes' sizes. Pajek can compute some vectors about our network for us. For instance, we can ask how many total courses each node is a prerequisite for by asking it to total up how many arrows lead out from each node. To do this, from Pajek's main window, choose Net > Vector > Summing up Values of Lines > Output. (All the lines in our network are of value 1, so this is really just counting.)

Notice how an entry now appears in the Vectors section of the main window. To see it in action, choose Draw > Draw-Vector (Ctrl+U). This does not draw the nodes colored according to partition; to do both at once, choose Draw > Draw-Partition-Vector (Ctrl+Q). The result is shown below. Clearly GB301, GB102, EXP101, and MK160 are the most required courses at Bentley.

There are many other things one can do with partitions and vectors. You should play around with the Net > Partition and Net > Vector menus yourself to see what options are available. If they don't seem self-explanatory, look them up in the Pajek manual (PDF form).

Shrinking a network

It would be interesting to get a bird's eye view of the network we're considering, say by lumping together all the courses of a common department and just seeing what departments have prerequisites in other departments. Luckily, Pajek has a quick way to do just that. Click Operations > Shrink Network > Partition, and then just say OK to every prompt it gives you until it's done.

You will now notice you have a new network on the topmost pick-list in the main window, and a new partition, each with only 22 nodes (instead of the original 168). To see it, ensure both are selected in their respective pick lists and click Draw > Draw-Partition. After using the Layout menu or just dragging things around, you should see a network like the one below. Note that each cluster in the partition was named with an arbitrary course from that partition, so GB202 really stands for "any GB course," and so on for each other node as well.

Final version

You can download a nice, full-size, PDF version of the graph (with all nodes hand-placed carefully apart from one another) by clicking here.