I’ve just written a very short Python script that will change an ncol graph file to Pajek format.
Some info on how to use it
The ncol File
The format of the ncol file will normally be like this
"node_1" "node_2" "node_2" "node_3"
The node names should not have any spaces and they should be separated by a space.
The Pajek File
The output file will look like this
*Vertices 3 1 "node_1" 2 "node_2" 3 "node_3" *Edges 1 2 2 3
For not it will only do vertices and edges, no archs.
First, you need to make file executable using chmod.
Another option is to run it like this in the terminal
$ python [path]/[to_the]/ncol2pajek.py
You may have to cd to the directory with the ncol file.
You will then be prompted to enter the name of the input and output file.
If all goes well, you will get something like this in the terminal
+ - - Loading File - - - + | | Vertices: 3 | Edges: 2 | + - - Pajek Complete - - +