USCCANA / netdiffuseR

netdiffuseR: Analysis of Diffusion and Contagion Processes on Networks
https://USCCANA.github.io/netdiffuseR
Other
85 stars 21 forks source link

diffnet_to_igraph fails when E(graph)$weight is NULL #16

Closed gvegayon closed 7 years ago

gvegayon commented 7 years ago

This returns with error

rm(list = ls())
library(igraph)
library(netdiffuseR)

set.seed(1)
ig_net <- barabasi.game(10)
V(ig_net)$toa <- c(1,1,1,1,3,3,3,3,6,6)
igraph_to_diffnet(ig_net, toavar="toa")
# Error in get.adjacency.sparse(graph, type = type, attr = attr, edges = edges,  : 
#  no such edge attribute

This fixes it... but shouldn't work like this

# Just realized that there is a problem in edges
E(ig_net)$weight <- rep(1, ecount(ig_net))
igraph_to_diffnet(ig_net, toavar="toa")
gvegayon commented 7 years ago

Fixed in 7468d50ff8211235192daeece583a025aa140c84