Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[stem-dev] Fwd: Pajek graphs

---------- Forwarded message ----------
From: Emily Nixon <emily.nixon@xxxxxxxxxxxxx>
Date: 10 March 2017 at 10:03
Subject: Pajek graphs
To: stem-dev@xxxxxxxxxxx

Hi everyone,

Here are the email threads related to issues with the pajek graphs. I've had to remove a few attachments that were confidential, but none of that would be relevant to anyone else anyway.

After discussing these issues in the recent STEM call, it was decided that the best way to import a pajek graph was to not use the Excel version with macros, but to go to this link and use the file you can download on that page under the heading "file format". This file needs to be opened using libra office. 

If for some reason you can't do that, then the emails below should help you to eventually work out how to do it using excel (it has worked for me now). If anyone is still having problems, then feel free to email me and hopefully I should be able to help.

Best wishes,


First email thread

Hi Matthias and Taras,

Thank you for taking the time to talk to me today, it was a really
interesting and useful session.

I will confirm about the workshop in January/Feb once I've heard back from
my line manager at the internship. I already have one colleague at the
university who would also be interested in attending.

I used the excel file with macros that you showed me earlier and when I
import the resultant net file, although the graph is being created in STEM,
the canonical graph won't open and on the error log it says "unhandled
event loop exception".

I've attached the pajek graph file in excel for you to have a look at if
you get a chance. Let me know if you think you know what the problem is. It
could maybe be a problem in my STEM rather than with the file? Perhaps you
could see if the file works in your STEM.

Best wishes,


Dear Emely,

a short follow up on my last finding. I discussed with Chris the issue and he explained that the Pajek importer
actually runs in two modes / versions behind the scenes.
The resources and the Excel macro we showed you today are linked with the old version of the Pajek importer which
allows you to use more tags but seems to have some unresolved bugs as well.
The new Pajek importer code, that do not support all the old tags in the .net file, is automatically invoked when there
are none of the old tags in the .net file. For details which tags are allowed please have a look at this site:

So, e.g. whenever STEM see a .net file with a "s_size" flag behind the node ID, the old code is used to import the .net
file, which in some currently unpredictable cases creates problems.

So I will keep you updated as soon we have a recommendation to circumvent that "mess".

Thanks for pointing us to this!!


>>> Matthias Filter 18.11.2016 17:46 >>>
Dear Emily,

I think I found the issue:
STEM seems to have problems with doubles as coordinates. If you multiply all coordinates with 10 then it works fine.


Attached a .net file that seems to work.
I did via "find and replace"
- change the node names to exclude any _ or -
- changed rateAB to rate
- delete the " 1 " in behind the node IDs in the edges
- deleted the s_size tag and the corresponding value.


After following all the instructions from the email above it worked.

Second email thread.

Hi Matthias,

Hope you, Chris and Taras are well.

I am currently trying to build a model in STEM while on my internship and I am having problems with the pajek graph generator. I'm not able to send you my file because the data is confidential, but I was wondering if you/Chris (I don't have his email address) could let me know whether there is a limit to the number of nodes you can use? I'm trying to make a graph using 37566 nodes and it keeps saying "Error reading number of nodes". I don't know whether this means it doesn't know how many nodes there are (even though I have specified this as usual -"*Vertices 37566", or whether it can't deal with this many nodes. An exception stack trace is not available from the error log.

If you could help in any way, I would greatly appreciate it! 

Best wishes,


Hi Emily,

I looked into the STEM source code to figure out when the error "Error reading number of nodes" occurs.
The reason must be, that the importer cannot read the line with the number of vertices.

1. It must be the first line in the file.
2. There must be a space between "*Vertices" and the number.

If it's exactly the line from you email ("*Vertices 37566"), it should work. If you cannot fix it on you own, you can
send me the file with the first line only.

Best regards,

I sent Chris my file

Hi Emily,

When I try to import your file, I get the error: "Error reading node at line 2!". So I don't get an error with the
first line.

Do you get the same error message, when you try to import the first-line-only-file?

Best Regards,

Hi Chris,

I'm now getting the same error as you even with the data included in line 2 onwards. Not sure what to do! I could make up some data and send to you and see if you can get that working? Any other suggestions?

I've managed to use a pajek file with my data to make a new graph in STEM, but it doesn't display the graph when I right click and select "display" (it works for other graphs when I do this). 

The error messages I got when it made a new graph (fdgdfdg.graph Pajek Net Graph Generator) with my pajek file are attached as images.

The way I got this pajek file to work was by using the excel spreadsheet provided with macros that doesn't quite work (email thread with Matthias). However, I ensured that it didn't have any of the old tags in it and I multiplied the coordinates by 10 as suggested by Matthias previously so I'm not sure why it isn't working. Perhaps the error messages will help!

Best wishes,


When you use the Excel Template for creating a Pajek file, the old erroneous Pajek format is used.
You should definitely use the new format, so we have to get your pajek file right.

How did you create the Pajek file with the "Error reading ...."? Maybe there is an illegal (invisible) character in the
text file.
Now you get the error in line 2, right? Could you send me the file with the first 3 lines only, without changing
anything in these 3 lines? There has to be something in these lines.

Best regards,

Hi Chris,

I can't give you the first 3 lines of true data, but I've edited the data so that it is formatted in the same way but made up data. I still get the same issue of the error in reading line 2 when I try to import this in STEM.

I've tried variations of this- not having the quotation marks "" around the node name and multiplying the coordinates by 10, but nothing works.

Maybe you can see the problem.

Best regards,


Hi Emily,

I found the issue. You have to separate the attributes with spaces and not with tabs. In the attached file I have
corrected line 2 and now the error is "Error reading node at line 3!".

To automatically replace all tabs with single spaces you can use a text editor like Notepad++.

In Notepad++ it's possible to replace tabs. You can download it here:

Here are my detailed instructions with screenshots ;)

1. Open your file in Notepad++ and select Search->Replace from the menu bar.

2. In the dialog switch to the "Extended Search Mode", type "\t" in "Find what" and in "Replace With" just press the
space bar once. Then press "Replace all".

Best regards,

It worked for me after I tried this. 

Emily Nixon
PhD Student
Demonstrator and Postgraduate Representative

School of Biological Sciences

University of Bristol
Bristol Life Sciences Building
24 Tyndall Avenue

Tel +44 (0)117 394 41389

Attachment: Chrisnotepadexample2.png
Description: PNG image

Attachment: Chrisnotepadexample1.png
Description: PNG image

Back to the top