|
Networks / Pajek |
Package for Large Network Analysis |
How to
run Pajek from command line or other programs
I have a question regarding Pajek and the use of macros:
Is it possible to start Pajek.exe from the command-line in such
a way that it is opening a given network and is starting the
given macro as well? I am thinking about:
pajek c:\mynetwork.net -macro c:\mymacro.mcr
I have to compute some values with pajek for MANY networks and
so I am trying to automate this task. I would be glad for any
help you can give me.
--
Tino Schölhorn
This operation is not completely supported in Pajek yet.
The current solution is based on the file Pajek.log in the Pajek's
program directory. At its startup Pajek executes macro calls from this
file. Here is an example of such file
NETBEGIN 1
CLUBEGIN 1
PERBEGIN 1
CLSBEGIN 1
HIEBEGIN 1
VECBEGIN 1
Msg Read network file
N 1 RDN D:\vlado\projects\PAJEK\DATA\internet\may.net
Msg All degree centrality
C 1 DEGC 1 [2]
C 1 WC D:\vlado\projects\stat\R\Pajek\may
EXIT
The file requires Pajek to read a network from a given file,
determine the degrees of vertices and store them on another
file. The command EXIT at its end requires Pajek to finish its
execution - otherwise it waits for user's interactive commands.
The easiest way to produce an appropriate LOG file for your task
is to do it first interactively, and then edit the produced LOG file
(from the working directory).
You can also invoke Pajek from some other programs.
Here we present how to do it from statistical program R
(CRAN,
download).
In this case we have to put in the Pajek's program directory
an additional command file runPajek.bat with the content
cd d:\programi\pajek
pajek
Now we can run R and with the commands
system("d:/programi/pajek/runPajek.bat",invisible=TRUE,wait=FALSE)
deg <- scan(file="D:/vlado/projects/stat/R/Pajek/may.clu",skip=1)
t <- table(deg)
pdf(file="D:/vlado/projects/stat/R/Pajek/degrees.pdf")
plot(as.integer(names(t)),log(t),xlab="degrees",ylab="log(frequency)")
dev.off()
run Pajek, read the obtained degrees into R
(vector deg), determine
the frequencies of degrees and draw them on the PDF file
degrees.pdf.
The files in darkred should be replaced by appropriate
names on your computer.
Pay attention also on / and \ characters in filenames
in different environments/ programs. And don't forget to remove the
Pajek.log file from the Pajek's program directory.
I'm particularly interested in the Fructerman/ Reinghold Layout
command- giving me different 2D or 3D node locations than an
input *.net file. I have hundreds (maybe thousands) of *.net
files that I need to convert to F/R 2D and F/R 3d *.net files
for ...
--
Dick Klavans
The following log file will do it for three networks:
- read the network file
- run layout algorithm (F-R, F-R 3D, K-K)
- save the network with layout coordinates in the same file
- dispose the network (free memory)
NETBEGIN 1
CLUBEGIN 1
PERBEGIN 1
CLSBEGIN 1
HIEBEGIN 1
VECBEGIN 1
Msg Reading Network --- D:\Pajek\DATA\TESTDATA\WRITE.NET
DRAWWINDOW OFF
N 1 RDN D:\Pajek\DATA\TESTDATA\WRITE.NET (56)
E 1 FRUCHT
N 1 WN D:\Pajek\DATA\TESTDATA\WRITE.NET 0 (56)
E 1 EPS 0 0 0 0 0 D:\Pajek\DATA\TESTDATA\write.eps
N 1 DN
Msg Reading Network --- D:\Pajek\DATA\TESTDATA\Aho1.net
N 2 RDN D:\Pajek\DATA\TESTDATA\Aho1.net (9)
E 2 FRUCHT3D
N 2 WN D:\Pajek\DATA\TESTDATA\Aho1.net 0 (9)
N 2 DN
Msg Reading Network --- D:\Pajek\DATA\TESTDATA\CIRC.NET
DRAWWINDOW ON
N 3 RDN D:\Pajek\DATA\TESTDATA\CIRC.NET (10)
E 3 KAMADA
E 3 BITMAP 0 0 0 0 0 D:\Pajek\DATA\TESTDATA\circ.bmp
N 3 WN D:\Pajek\DATA\TESTDATA\CIRC.NET 0 (10)
N 3 DN
EXIT
Visibility of Draw window
DRAWWINDOW OFF
After this command all layouts in Draw window are omitted (computed but not drawn).
DRAWWINDOW ON
After this command layouts in Draw window are visible during batch execution
Default is ON.
Layout in Pajek DRAW window
E net DRAW clu vecx vecy clu2 clu3
colors of vertices are determined by partition clu and x and y sizes
by vectors vecx and vecy.
Color of font of vertices can be determined by partition clu2 and
size of font of vertices by partition clu3 (otherwise input 0 0).
DRAW commands are written to log file only when Draw
is called explicitly from Pajek main window,
e.g. using Draw/Draw-Partition, but not for example when Redraw is clicked.
Optimization using Kamada-Kawai algorithm
E net KAMADA
or, for drawing networks with several components
E net KAMADACOMP
Optimization using 2D Fruchterman-Rheingold algorithm
E net FRUCHT
Optimization using 3D Fruchterman-Rheingold algorithm
E net FRUCHT3D
GIVENZ ON
Keep the current z-coordinate during the optimization
GIVENZ OFF
Remove freezing z-coordinate.
Export to EPS
E net EPS clu vecx vecy clu2 clu3 EPSfile
colors of vertices are determined by partition clu and x and y sizes
by vectors vecx and vecy.
Color of font of vertices can be determined by partition clu2 and
size of font of vertices by partition clu3 (otherwise input 0 0).
Export to SVG
E net SVG clu vecx vecy clu2 clu3 SVGfile SVGtype SVGsubtype
colors of vertices are determined by partition clu and x and y sizes
by vectors vecx and vecy.
Color of font of vertices can be determined by partition clu2 and
size of font of vertices by partition clu3 (otherwise input 0 0).
SVGtype | SVGsubtype | Description |
1 | 0 | General |
2 | 0 | Labels/Arcs/Edges |
3 | 0 | Partition/Classes |
4 | 0 | Partition/Nested Classes |
5 | 0 | Partition/Classes with semi-lines |
7 | 1 | Line Values |
7 | 2 | Line Values - Use Colors |
7 | 3 | Line Values - Use GreyScale |
7 | 4 | Line Values - Different Widths |
7 | 5 | Line Values - GreyScale and Different Widths |
7 | 6 | Line Values - Use Colors and Different Widths |
8 | 1 | MultipleRelationsNetwork |
Export to X3D
E net X3D clu vecx vecy clu2 clu3 X3Dfile VerticesSize LinesSize
colors of vertices are determined by partition clu and x and y sizes
by vectors vecx and vecy.
Color of font of vertices can be determined by partition clu2 and
size of font of vertices by partition clu3 (otherwise input 0 0).
VerticesSize determines vertices resize factor and LinesSize lines resize factor
Export to VRML
E net VRML clu vecx vecy VRMLfile VerticesSize LinesSize
colors of vertices are determined by partition clu and x and y sizes
by vectors vecx and vecy.
VerticesSize determines vertices resize factor and LinesSize lines resize factor
Export to MDLMOLfile
E net MDLMOL clu vecx vecy MDLfile VerticesSize
colors of vertices are determined by partition clu and x and y sizes
by vectors vecx and vecy.
VerticesSize determines vertices resize factor
Export to KineMage
E net MAGE clu vecx vecy MAGEfile VerticesType VerticesSize NeighbourClusters ExportType
colors of vertices are determined by partition clu and x and y sizes
by vectors vecx and vecy.
VerticesType: 1-spheres, 2-labels, 3-balls;
VerticesSize: vertices resize factor
NeighbourClusters: how many neighbour clusters to show
ExportType: 0 - Current Network Only; 1 - Current and all Subsequent; 2 - Multiple Relations Network.
Export to BITMAP
E net BITMAP clu vecx vecy clu2 clu3 BMPfile
colors of vertices are determined by partition clu and x and y sizes
by vectors vecx and vecy.
Color of font of vertices can be determined by partition clu2 and
size of font of vertices by partition clu3 (otherwise input 0 0).
Determining layout using EigenVectors
E net EIGEN val1 val2 val3 LineValues Start
val1,val2,val3: eigenvalues
LineValues: n-forget, s-similarities, d-dissimilarities
Start: Start computing eigenvalues (use 0 as default)
Rotating layout
E net ROT3D x y z Angle Step
x,y,z: axis (normal) of rotation
Angle: angle to rotate layout for
Step: step of rotation (smaller step, slower rotation)
Drawing on a CIRCLE
E net CIRCULAR
Drawing on a CIRCLE in RANDOM order
E net RANDOMCIRCULAR
Drawing on a CIRCLE using PERMUTATION
E net PERMUTCIRCULAR per
ordering is determined by permutation per
Drawing on several CIRCLES using PARTITION
E net PARTCIRCULAR clu
circles are determined by partition clu
Drawing in Layers
E net LAYERS?? clu
layers are determined by partition clu.
Four options for drawing in layers:
LAYERSNY - 2D layers in y direction
LAYERSRY - 2D layers in y direction + random in x
LAYERSNZ - 3D layers in z direction
LAYERSRZ - 3D layers in z direction + random in xy
How to ensure that layouts will always look the same whenever log file is run?
Store parameters (sizes of windows, vertices, permutation of partition colors...)
that you want to keep in INIfile using Options/Ini File/Save
or using command in log file
SAVEINI INIfile
Before running the log file it is recommended to load the saved configuration in INIfile
using Options/Ini File/Load
or by including command
LOADINI INIfile
in corresponding log file before commands producing layouts
How to?;
Pajek;
Vlado/Networks
|