[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] edge attributes and delete.edges
From: |
Gabor Csardi |
Subject: |
Re: [igraph] edge attributes and delete.edges |
Date: |
Mon, 13 Nov 2006 17:27:11 -0500 |
User-agent: |
Mutt/1.5.11 |
On Mon, Nov 13, 2006 at 05:13:49PM -0500, Vincent Matossian wrote:
> Thanks Gabor, the workaround code you sent seems to work ok for a random
> graph but fails for a barabasi.game with the error
>
> Error in E(g, P = t(get.edgelist(mst))) : At type_indexededgelist.c:935 :
> Cannot get edge id, no such edge, Invalid value
>
> Also, I am not interested in weight as edge attributes and so do not want the
> MST to be affected by it. I will think of a way around this...but if you have
> any idea let me know :)
Hmmm, that is quite strange to be honest. The problem is that the barabasi
graph is directed (by default) and it seems that there is a bug in
minimum.spanning.tree: if you do it on a directed graph it does not keep the
directedness of the edges. This is a serious bug, i'll correct it this
evening (perhaps night).
If you don't want the mst to consider weights just leave out that argument.
Here is the example again:
g <- simplify(barabasi.game(10, m=2, directed=FALSE))
co <- layout.fruchterman.reingold(g)
E(g)$weight <- sample(1:10, ecount(g), repl=T)
plot(g, layout=co, edge.labels=E(g)$weight)
mst <- minimum.spanning.tree(g)
E(mst)$weight <- NA
E(mst, P=t(get.edgelist(mst)))$weight <- E(g, P=t( get.edgelist(mst)))$weight
x11(); plot(mst, layout=co, edge.labels=E(mst)$weight)
G.
> Thanks again for your input
>
> -
> vincent
>
--
Csardi Gabor <address@hidden> MTA RMKI, ELTE TTK