You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to randomly rewire the edges while keeping the degree distribution fixed, so this is what I do:
r<- rewire(n, keeping_degseq())
The result looks nice at first sight…
> r
IGRAPH DNW- 67 59 --
+ attr: name (v/c), weight (e/n)
+ edges (vertex names):
[1] Dipl.-Kfm. Dr. Günter Stummvoll ->Kurt Eder
[2] Mag. Dr. Heide Schmidt ->Mag. Terezija Stoisits
[3] Mag. Dr. Maria Theresia Fekter ->Dr. Peter Kostelka
[4] Mag. Helmut Kukacka ->Franz Hums
[5] MMag. Dr. Madeleine Petrovic ->Sonja Ablinger
[6] Dipl.-Ing. Dr. Peter Keppelmüller->Friedrich Verzetnitsch
[7] Karlheinz Kopf ->Arnold Grabner
[8] Dr. Alexander Van der Bellen ->Mag. Helmut Peter
+ ... omitted several edges
… but many of the edge weights seem to get lost in translation:
> E(r)$weight
[1] 1 1 2 1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
[38] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
I have reproduced the same issue on several similar graphs.
Am I doing something wrong here?
The text was updated successfully, but these errors were encountered:
Looks like and igraph bug. Thanks for reporting it!
library(igraph)
g<- sample_gnm(10, 20)
E(g)$weight<- seq_len(gsize(g))
g2<- rewire(g, keeping_degseq())
E(g2)$weight#> [1] 11 13 18 20 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
The C core currently implements rewiring by removing edges and adding them in a new configuration. Edge attributes are lost in the process; newly added edges will get a default value of NA. Currently this cannot be fixed in the R interface alone; the C core would need to be adjusted to provide support for rewiring while keeping attributes.
Hi,
I have this perfectly nice-looking
igraph
object of Austrian legislators at hand:The object has edge weights assigned to the
E(n)$weight
attribute, as expected by manyigraph
functions:I'd like to randomly rewire the edges while keeping the degree distribution fixed, so this is what I do:
The result looks nice at first sight…
… but many of the edge weights seem to get lost in translation:
I have reproduced the same issue on several similar graphs.
Am I doing something wrong here?
The text was updated successfully, but these errors were encountered: