[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[igraph] Assign Weight to Link by Counting Repetitions
From: |
Lorenzo Isella |
Subject: |
[igraph] Assign Weight to Link by Counting Repetitions |
Date: |
Fri, 02 Oct 2009 12:14:48 +0200 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090817) |
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] Assign Weight to Link by Counting Repetitions,
Lorenzo Isella <=