A quickstart guide to drawing networks with PAJEK

  • Slides: 33
Download presentation
A quick-start guide to drawing networks with PAJEK. What: Pajek is a free network

A quick-start guide to drawing networks with PAJEK. What: Pajek is a free network analysis program specializing in the drawing and analysis of very large graphs. It works in Windows (or w. a windows emulator in mac) Where: Download the most recent version from: http: //mrvar. fdv. uni-lj. si/pajek/ Data: Pajek uses simple text files for input, there are multiple formats and options, but the most common we’ll use is a twopart file structure. The first part of the file is a node-list (one row per node), and can include many descriptors (color, position, etc. ), but at minimum has to have the node number and a label. The second part of the file is an arc (if directed) or edge (if undirected) list. Minimum information is three columns: From. Node To. Node Value. So a minimum file format for a small network would be:

A quick-start guide to drawing networks with PAJEK. Getting Started: Once downloaded, install the

A quick-start guide to drawing networks with PAJEK. Getting Started: Once downloaded, install the program. It’s a rare program for most virus protection software, so you’ll likely get some warnings from them. You can ignore them if you downloaded it from the site linked above. After installing, and opening, it should look something like this:

A quick-start guide to drawing networks with PAJEK. GUI: Pajek works by linking the

A quick-start guide to drawing networks with PAJEK. GUI: Pajek works by linking the active network object to other data objects. These are: • Partitions: Categorical attributes of nodes, must be stored as integers • Vectors: real-number values on nodes (like centrality), can be decimal values These are single column text files sorted to match the network object. Rarely used but for completeness: • Permutations: a sorting vector – we rarely use this • Cluster: a subset of nodes – can useful for selecting specific nodes to label • Hierarchy: a nested subset of nodes

A quick-start guide to drawing networks with PAJEK. Load a data file Read a

A quick-start guide to drawing networks with PAJEK. Load a data file Read a network from your local file network read Create a vector based on centrality: network create vector centrality weighted degree all Your GUI should look like this: Now draw the network as: Draw network + first vector

A quick-start guide to drawing networks with PAJEK. Now draw the network as: Draw

A quick-start guide to drawing networks with PAJEK. Now draw the network as: Draw network + first vector It should look like this:

A quick-start guide to drawing networks with PAJEK. Change from node numbers to node

A quick-start guide to drawing networks with PAJEK. Change from node numbers to node labels with options mark vertices using Lables (or “Cntr-L”). Note you can click & drag nodes as you like, display values on edges (cntrl-v), etc.

A quick-start guide to drawing networks with PAJEK. A more complicated example: one of

A quick-start guide to drawing networks with PAJEK. A more complicated example: one of the add-health networks. Open “comm 1. net” from: http: //www. soc. duke. edu/~jmoody 77/S NH/comm 1. net and save to your local drive. Open PAJEK & read in as the first network object.

A quick-start guide to drawing networks with PAJEK. Now let’s create a partition based

A quick-start guide to drawing networks with PAJEK. Now let’s create a partition based on the community structure of the network: Network create partition communitites Louvain Method multi-level refinements. You’ll get a dialog something like this: We’ll talk about the values later, make yours match this for the first run (then play with it!)

A quick-start guide to drawing networks with PAJEK. Now let’s create a partition based

A quick-start guide to drawing networks with PAJEK. Now let’s create a partition based on the community structure of the network. The log should give you something like:

A quick-start guide to drawing networks with PAJEK. Now lets create a vector for

A quick-start guide to drawing networks with PAJEK. Now lets create a vector for centrality: Network create vector centrality closeness all Your GUI should look like this:

A quick-start guide to drawing networks with PAJEK. Now go draw partition + First

A quick-start guide to drawing networks with PAJEK. Now go draw partition + First Vector:

A quick-start guide to drawing networks with PAJEK. Window should look something like this.

A quick-start guide to drawing networks with PAJEK. Window should look something like this. Not much difference in node size here by closeness centrality (as the network is pretty strongly connected). Let’s try another: weighted degree. Go back to the main window and do: Network create vector centrality weighted degree all

A quick-start guide to drawing networks with PAJEK. Window should look something like this.

A quick-start guide to drawing networks with PAJEK. Window should look something like this. Depending on the defaults, your nodes could be larger or smaller making it easier/harder to see. Go to options size Vertices to adjust, clicking on “Graph only” removes the arrows & node number labels

A quick-start guide to drawing networks with PAJEK. Window should look something like this.

A quick-start guide to drawing networks with PAJEK. Window should look something like this. Depending on the defaults, your nodes could be larger or smaller making it easier/harder to see. Go to options size Vertices to adjust, clicking on “Graph only” removes the arrows & node number labels Now lets try some different layout options.

A quick-start guide to drawing networks with PAJEK. Layout circular original

A quick-start guide to drawing networks with PAJEK. Layout circular original

A quick-start guide to drawing networks with PAJEK. Layout circular using partitions

A quick-start guide to drawing networks with PAJEK. Layout circular using partitions

A quick-start guide to drawing networks with PAJEK. Layout energy kamada kaway Separate components

A quick-start guide to drawing networks with PAJEK. Layout energy kamada kaway Separate components (cntrl-k). Do you see those numbers out in the middle of nowhere? 4 and 17? These are isolates. Because they have degree=0, and we’re drawing size proportional to weighted degree, they are plotted as having no size. You can adjust this by going to vector transform add constant 1 (or whatever value you like)

A quick-start guide to drawing networks with PAJEK. Layout energy kamada kaway Separate components

A quick-start guide to drawing networks with PAJEK. Layout energy kamada kaway Separate components (cntrl-k). Oftentimes we just want to exclude the isolates/small chunks from the display. Do this in the main window: Networks create partition components weak min size to display: something big, like 20 or some such

A quick-start guide to drawing networks with PAJEK. Now select just the largest component:

A quick-start guide to drawing networks with PAJEK. Now select just the largest component: Operations network + Partition extract subnetwork (or cntrl-e), in the dialog select cluster 1: Note that now those two nodes are gone:

A quick-start guide to drawing networks with PAJEK. To get your community partition back,

A quick-start guide to drawing networks with PAJEK. To get your community partition back, you need a new partition that’s the same size (69) nodes from the original. So you need to apply the same partition extraction to the partition that you did to the network. - select the clustering solution as the first partition - Select the weak components partition as the 2 nd partition (should look like at right) Partitions extract subpartition (second from first):

A quick-start guide to drawing networks with PAJEK. Your should now have a network

A quick-start guide to drawing networks with PAJEK. Your should now have a network object in the network window with 69 vertices: Need to get a new centrality score for this smaller network. You can do this by operations vector+partition and extract like above, or, simpler, just recalculate as network create vector centrality weighted degree all:

A quick-start guide to drawing networks with PAJEK. Result of draw partition + first

A quick-start guide to drawing networks with PAJEK. Result of draw partition + first vector should then look something like this (note you can also get simple degree, not weighted, by “cntrl-d”) Another common layout is Fruchterman Rheingold: Layout energy Frucherman Rheingold make sure the factor is about 1. 0, if it is not, change it

A quick-start guide to drawing networks with PAJEK. Should look something like this. Very

A quick-start guide to drawing networks with PAJEK. Should look something like this. Very few layouts “work” with just the defaults. Here there a lot of overlapping nodes and such. You can go in by hand adjust, minor adjustments to this version for me would give us: (do a quick page-up, page down to compare)

A quick-start guide to drawing networks with PAJEK. Should look something like this. Very

A quick-start guide to drawing networks with PAJEK. Should look something like this. Very few layouts “work” with just the defaults. Here there a lot of overlapping nodes and such. You can go in by hand adjust, minor adjustments to this version for me would give us: (do a quick page-up, page down to compare) The goal of moving by hand was to disambiguate some of the crossing lines (note the line connecting that yellow dyad to the rest of the yellow group looked like it was from the white/purple nodes, etc. ) One way to measure fit: info Correlation between Layout and Geodesic: here result is about 0. 76

A quick-start guide to drawing networks with PAJEK. Should look something like this. To

A quick-start guide to drawing networks with PAJEK. Should look something like this. To produce a graph for publication, likely want to adjust colors & such, perhaps transparency, etc. To do so, you’d export from PAJEK to a graphics program. Start by adjusting the export parameters: export options Main bits you’ll likely want to adjust are the size of vertices, opacity, edge width…but basically play with these to get a initial. svg or. eps you like. Let’s just run it w. defaults:

A quick-start guide to drawing networks with PAJEK. Should look something like this. This

A quick-start guide to drawing networks with PAJEK. Should look something like this. This is OK, but I don’t like the double -headed arcs, so going to change the graph to be a mix of arcs and edges. In the main window: Network create new network arcs to edges bidirected only max value. That gives:

A quick-start guide to drawing networks with PAJEK. Should look something like this. Now

A quick-start guide to drawing networks with PAJEK. Should look something like this. Now note the light blue edges without any arrows? This is better, but I want to highlight the reciprocal ties a little more, so going to adjust the edge width in the export option. In fact, since the network is valued, let’s incorporate that into all the ties. In the drawing window under “options lines” choose “different widths”. Adjust some of the color/thickness settings:

A quick-start guide to drawing networks with PAJEK. Should look something like this. I

A quick-start guide to drawing networks with PAJEK. Should look something like this. I lightened the lines in illustrator by making them transparent (50%), but that’s a minor touch. Else these are settings used:

A quick-start guide to drawing networks with PAJEK. This just scratches the surface so

A quick-start guide to drawing networks with PAJEK. This just scratches the surface so you can play with the program some more. A couple of interesting features to note that we didn’t cover. a) there’s a hidden “script” language in PAJEK. Each session generates a log, for the session outlined above that looks like. If you’re handy with any script-writing language, you can generate these directly and read them in. This comes in very handy if you need to do a costly calculation on a large network, as PAJEK is very fast at it.

A quick-start guide to drawing networks with PAJEK. This just scratches the surface so

A quick-start guide to drawing networks with PAJEK. This just scratches the surface so you can play with the program some more. A couple of interesting features to note that we didn’t cover. b) You can export anything to R, SPSS, Excell, Etc. These are all under the “Tools” menus

A quick-start guide to drawing networks with PAJEK. This just scratches the surface so

A quick-start guide to drawing networks with PAJEK. This just scratches the surface so you can play with the program some more. A couple of interesting features to note that we didn’t cover. c) If you find yourself doing the same thing frequently, consider making a macro. This is also where you’ll find the option to repeat a prior session (useful if you need to replicate something for an R&R!, just save your log file to a place you want to archive and go back to it to repeat)

A quick-start guide to drawing networks with PAJEK. This just scratches the surface so

A quick-start guide to drawing networks with PAJEK. This just scratches the surface so you can play with the program some more. A couple of interesting features to note that we didn’t cover. d) For exploratory bits, it’s useful to often select and move nodes – you can “grasp” next to a group and move all groups of that color. You should spend some time just playing with the layout tools and options.

A quick-start guide to drawing networks with PAJEK. Other resources for PAJEK: 1) The

A quick-start guide to drawing networks with PAJEK. Other resources for PAJEK: 1) The main PAJEK book is “Exploratory Network Analysis with Pajek. ” The old version is http: //courses. arch. ntua. gr/fsr%2 F 144992/Pajek-Manual. pdf (it’s for an earlier version of PAJEK, so some of the menus are different, but steps are the same). If you want the updated version, try: https: //www. amazon. com/Exploratory-Network-Analysis-Structural. Sciences/dp/0521174805