[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Igraph and SONIA
From: |
Simone Gabbriellini |
Subject: |
Re: [igraph] Igraph and SONIA |
Date: |
Wed, 20 Oct 2010 17:50:25 +0200 |
thanks Gabor!
it would be great to have it included in the next igraph release.
best,
Simone
Il giorno 20/ott/2010, alle ore 17.40, Gábor Csárdi ha scritto:
> Lorenzo, Simone,
>
> here is a function that seems to work on two of the three examples at
> the sonia website:
>
> sonia2igraph <- function(filename, directed=TRUE) {
> lines <- readLines(filename)
> lines <- grep("^//", lines, value=TRUE, invert=TRUE)
> fromid <- grep("^FromId", lines)[1]
> nodes <- lines[1:(fromid-1)]
> edges <- lines[fromid:length(lines)]
>
> nodes <- strsplit(split="\t", nodes)
> nodesnames <- nodes[[1]]
> nodes <- data.frame(do.call(rbind, nodes[-1]))
> colnames(nodes) <- nodesnames
> colnames(nodes)[1] <- "name"
>
> edges <- strsplit(split="\t", edges)
> edgesnames <- edges[[1]]
> edges <- data.frame(do.call(rbind, edges[-1]))
> colnames(edges) <- edgesnames
>
> graph.data.frame(edges, directed=directed, vertices=nodes)
> }
>
> All attributes are added as strings, modify the function if you want
> to convert them to numeric and/or use the igraph attribute names:
> 'color', etc. Clusters are not supported.
>
> The third example file does not work, because it contains multiple
> lines for the same vertex, and I don't know what this means. They do
> not say anything about this on the website, unfortunately.
>
> I have added a bug report for putting (and extended version of) this
> into igraph:
> https://bugs.launchpad.net/igraph/+bug/663959
>
> Best,
> Gabor
>
> On Wed, Oct 20, 2010 at 5:04 PM, Simone Gabbriellini
> <address@hidden> wrote:
>> Gabor,
>>
>> http://sourceforge.net/apps/mediawiki/sonia/index.php?title=Son_format
>>
>> I am interested too, so I've joined the thread
>>
>> best,
>> simone
>>
>> Il giorno 20/ott/2010, alle ore 16.58, Gábor Csárdi ha scritto:
>>
>>> Lorenzo,
>>>
>>> could you please point me to the SONIA file format? Time information
>>> can be added as vertex/edge attributes, so that is not a problem I
>>> guess.
>>>
>>> Best,
>>> Gabor
>>>
>>> On Wed, Oct 20, 2010 at 4:44 PM, Lorenzo Isella
>>> <address@hidden> wrote:
>>>> Dear All,
>>>> I am not experienced at all about the various formats for storing networks,
>>>> but someone told me that the SONIA format is quite common for
>>>> visualizing/representing dynamical networks.
>>>> I found several online resources telling how to save an igraph graph in the
>>>> SONIA format, e.g.
>>>>
>>>> http://bit.ly/fTqhQ and
>>>> http://cran.r-project.org/web/packages/igraphtosonia/
>>>>
>>>> but can I also go the other way around (reading a graph stored in the SONIA
>>>> format as an igraph graph)? Or am I asking a question which does not make
>>>> sense as igraph would (perhaps) have troubles in dealing with nodes/edges
>>>> specified as having a finite lifetime?
>>>> Many thanks
>>>>
>>>> Lorenzo
>>>>
>>>> _______________________________________________
>>>> igraph-help mailing list
>>>> address@hidden
>>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>>>
>>>
>>>
>>>
>>> --
>>> Gabor Csardi <address@hidden> UNIL DGM
>>>
>>> _______________________________________________
>>> igraph-help mailing list
>>> address@hidden
>>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>>
>> _______________________________________________
>> igraph-help mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/igraph-help
>>
>
>
>
> --
> Gabor Csardi <address@hidden> UNIL DGM
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help