[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] writing Pajek temporal networks
From: |
Tamás Nepusz |
Subject: |
Re: [igraph] writing Pajek temporal networks |
Date: |
Wed, 8 Aug 2012 23:03:55 +0200 |
> I tried searching for this and coding it, but i'm still a little stumped by
> indexing of igraph objects. Is there a ready way to write out to a Pajek file
> in the format it's expecting for "temporal" networks (example file-structure
> below)? I have the time intervals as node and edge attributes and are ready
> to be output, but I'm not quite getting it right.
Unfortunately temporal networks are not supported by igraph's Pajek writer yet.
However, if you don't mind a bit of extra coding, you can probably proceed as
follows (without going into details since I don't know whether you are working
with igraph form C, R or Python):
1. Write the Pajek network into a file without the temporal information.
2. Open it as a regular file and create a new, empty file as well.
3. For each line in the input file, do the following:
- If the line starts with *, copy it into the output file as is
- If the line refers to a vertex (which you can determine by counting how many
lines starting with * you have seen so far; if you have seen only one such
line, you are in the vertex section), extract the time ranges from the
attributes of the corresponding vertex, append them to the end of the line and
print the modified line into the output file
- Similarly, if the line refers to an edges, extract the time ranges from the
attributes of the corresponding edge, append them to the end of the line and
print it
Hope this helps.
All the best,
Tamas