Read .net pajek file using python igraph library
Question: I am trying to load a .net file using python igraph library. Here is the
sample code:

    
    
    import igraph
    g = igraph.read("s.net",format="pajek")
    

But when I tried to run this script I got the following errors:

    
    
    Traceback (most recent call last):
    File "demo.py", line 2, in <module>
    g = igraph.read('s.net',format="pajek")
    File "C:\Python27\lib\site-packages\igraph\__init__.py", line 3703, in read
    return Graph.Read(filename, *args, **kwds)
    File "C:\Python27\lib\site-packages\igraph\__init__.py", line 2062, in Read
    return reader(f, *args, **kwds)
    igraph._igraph.InternalError: Error at .\src\foreign.c:574: Parse error in Pajek
    file, line 1 (syntax error, unexpected ARCSLINE, expecting VERTICESLINE), Parse error
    

Kindly provide some hint over it.


Answer: Either your file is not a regular Pajek file or igraph's Pajek parser is not
able to read this particular Pajek file. (Writing a Pajek parser is a bit of
hit-and-miss since the Pajek file format has no formal specification). If you
send me your Pajek file via email, I'll take a look at it.

**Update** : you were missing the `*Vertices` section of the Pajek file.
Adding a line like `*Vertices N` (where `N` is the number of vertices in the
graph) resolves your problem. I cannot state that this line is mandatory in
Pajek files because of lack of formal specification for the file format, but
all the Pajek files I have seen so far included this line so I guess it's
pretty standard.

