|
From: | Vincent Matossian |
Subject: | Re: [igraph] edge attributes and delete.edges |
Date: | Mon, 13 Nov 2006 17:13:49 -0500 |
On Mon, Nov 13, 2006 at 03:11:27PM -0500, Vincent Matossian wrote:
> Thanks! I will apply the patch for now.
>
> I was actually reading those exact lines in type_indexededgelist.c when I
> received your message :)
>
> I have another question however, minimum.spanning.tree creates a new graph and
> as a result all attributes are lost, is there a quick way to maintain edge
> attributes?
Hmmm. The vertices are preserved, so that is easy. As for the edges, that is
more tricky and for a clear solution the C code should be updated.
A quick workaround for graphs without multiple edges:
g <- erdos.renyi.game(10, 3/10)
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, weights=E(g)$weight, algorithm="prim")
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)
A better solution would be if minimum.spanning.tree simply returned an edge
sequence, at least internally. On the TODO list.
Gabor
> Thanks again for all your help,
>
> Vincent
>
>
--
Csardi Gabor <address@hidden> MTA RMKI, ELTE TTK
_______________________________________________
igraph-help mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/igraph-help
[Prev in Thread] | Current Thread | [Next in Thread] |