igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] Assign Weight to Link by Counting Repetitions


From: Gábor Csárdi
Subject: Re: [igraph] Assign Weight to Link by Counting Repetitions
Date: Fri, 2 Oct 2009 12:17:32 +0200

Lorenzo,

see ?count.multiple, the last example on the manual page actually does
exactly what you want.

Best,
Gabor

On Fri, Oct 2, 2009 at 12:14 PM, Lorenzo Isella
<address@hidden> wrote:
> Dear All,
> I often deal with graphs which are stored into files in the following form
>
> 174514432 95879170
> 78774272 78774272
> 74514432 95879170
> 78774272 78774272
> 74514432 95879170
> 78774272 78774272
> 74514432 95879170
> 78774272 78774272
> 74514432 95879170
> 78774272 78774272
> 74514432 95879170
> 78774272 78774272
> 74514432 95879170
> 78774272 78774272
> 74514432 95879170
> 78774272 78774272
> 74514432 95879170
> 78774272 78774272
> 74514432 95879170
> 78774272 78774272
> 74514432 95879170
>
> Do not be afraid of the long numbers; they are simply node labels used to
> construct an adjacency list.
> Gabor pointed out that if these data are saved into graph_list_no_rep_dat,
> then I can read the graph as
>
>> tab <- read.table("graph_list_no_rep_dat")
>> g <- graph.data.frame(tab, dir=FALSE)
>
> However, if you look at the graph above, you notice that some edges appear
> more than once and there are some self-loops.
> Without going into details, this happens since this is a network aggregated
> over time.
> By doing something like
>
> g<-simplify(g)
>
> I have a nice and clean graph without self-loops and repeated edges. It is
> OK for me to get rid of self-loops, but my only problem is that I would like
> to keep the info about how many times each edge used to appear and I would
> like to store this info as a weight associated to the edge itself.
> Any suggestions about how to achieve that efficiently?
> Many thanks
>
> Lorenzo
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

[Prev in Thread] Current Thread [Next in Thread]